This class acts as a tagged union. Only one of the ``is_*`` methods will return true. To get the associated value of a tag (if one exists), use the corresponding ``get_*`` method.
| 1327 | CreateSharedLinkArg_validator = bv.Struct(CreateSharedLinkArg) |
| 1328 | |
| 1329 | class CreateSharedLinkError(bb.Union): |
| 1330 | """ |
| 1331 | This class acts as a tagged union. Only one of the ``is_*`` methods will |
| 1332 | return true. To get the associated value of a tag (if one exists), use the |
| 1333 | corresponding ``get_*`` method. |
| 1334 | """ |
| 1335 | |
| 1336 | _catch_all = 'other' |
| 1337 | # Attribute is overwritten below the class definition |
| 1338 | other = None |
| 1339 | |
| 1340 | @classmethod |
| 1341 | def path(cls, val): |
| 1342 | """ |
| 1343 | Create an instance of this class set to the ``path`` tag with value |
| 1344 | ``val``. |
| 1345 | |
| 1346 | :param files.LookupError val: |
| 1347 | :rtype: CreateSharedLinkError |
| 1348 | """ |
| 1349 | return cls('path', val) |
| 1350 | |
| 1351 | def is_path(self): |
| 1352 | """ |
| 1353 | Check if the union tag is ``path``. |
| 1354 | |
| 1355 | :rtype: bool |
| 1356 | """ |
| 1357 | return self._tag == 'path' |
| 1358 | |
| 1359 | def is_other(self): |
| 1360 | """ |
| 1361 | Check if the union tag is ``other``. |
| 1362 | |
| 1363 | :rtype: bool |
| 1364 | """ |
| 1365 | return self._tag == 'other' |
| 1366 | |
| 1367 | def get_path(self): |
| 1368 | """ |
| 1369 | Only call this if :meth:`is_path` is true. |
| 1370 | |
| 1371 | :rtype: files.LookupError |
| 1372 | """ |
| 1373 | if not self.is_path(): |
| 1374 | raise AttributeError("tag 'path' not set") |
| 1375 | return self._value |
| 1376 | |
| 1377 | def _process_custom_annotations(self, annotation_type, field_path, processor): |
| 1378 | super(CreateSharedLinkError, self)._process_custom_annotations(annotation_type, field_path, processor) |
| 1379 | |
| 1380 | CreateSharedLinkError_validator = bv.Union(CreateSharedLinkError) |
| 1381 |