|
28 | 28 | from openstack.network.v2 import router as _router |
29 | 29 | from openstack.network.v2 import security_group as _security_group |
30 | 30 | from openstack.network.v2 import security_group_rule as _security_group_rule |
| 31 | +from openstack.network.v2 import segment as _segment |
31 | 32 | from openstack.network.v2 import subnet as _subnet |
32 | 33 | from openstack.network.v2 import subnet_pool as _subnet_pool |
33 | 34 | from openstack.network.v2 import vpn_service as _vpn_service |
@@ -1444,6 +1445,58 @@ def security_group_rules(self, **query): |
1444 | 1445 | return self._list(_security_group_rule.SecurityGroupRule, |
1445 | 1446 | paginated=False, **query) |
1446 | 1447 |
|
| 1448 | + def find_segment(self, name_or_id, ignore_missing=True): |
| 1449 | + """Find a single segment |
| 1450 | +
|
| 1451 | + .. caution:: |
| 1452 | + BETA: This API is a work in progress and is subject to change. |
| 1453 | +
|
| 1454 | + :param name_or_id: The name or ID of a segment. |
| 1455 | + :param bool ignore_missing: When set to ``False`` |
| 1456 | + :class:`~openstack.exceptions.ResourceNotFound` will be |
| 1457 | + raised when the resource does not exist. |
| 1458 | + When set to ``True``, None will be returned when |
| 1459 | + attempting to find a nonexistent resource. |
| 1460 | + :returns: One :class:`~openstack.network.v2.segment.Segment` or None |
| 1461 | + """ |
| 1462 | + return self._find(_segment.Segment, name_or_id, |
| 1463 | + ignore_missing=ignore_missing) |
| 1464 | + |
| 1465 | + def get_segment(self, segment): |
| 1466 | + """Get a single segment |
| 1467 | +
|
| 1468 | + .. caution:: |
| 1469 | + BETA: This API is a work in progress and is subject to change. |
| 1470 | +
|
| 1471 | + :param segment: The value can be the ID of a segment or a |
| 1472 | + :class:`~openstack.network.v2.segment.Segment` |
| 1473 | + instance. |
| 1474 | +
|
| 1475 | + :returns: One :class:`~openstack.network.v2.segment.Segment` |
| 1476 | + :raises: :class:`~openstack.exceptions.ResourceNotFound` |
| 1477 | + when no resource can be found. |
| 1478 | + """ |
| 1479 | + return self._get(_segment.Segment, segment) |
| 1480 | + |
| 1481 | + def segments(self, **query): |
| 1482 | + """Return a generator of segments |
| 1483 | +
|
| 1484 | + .. caution:: |
| 1485 | + BETA: This API is a work in progress and is subject to change. |
| 1486 | +
|
| 1487 | + :param kwargs \*\*query: Optional query parameters to be sent to limit |
| 1488 | + the resources being returned. Available parameters include: |
| 1489 | +
|
| 1490 | + * network_id: ID of the network that owns the segments |
| 1491 | + * network_type: Network type for the segments |
| 1492 | + * physical_network: Physical network name for the segments |
| 1493 | + * segmentation_id: Segmentation ID for the segments |
| 1494 | +
|
| 1495 | + :returns: A generator of segment objects |
| 1496 | + :rtype: :class:`~openstack.network.v2.segment.Segment` |
| 1497 | + """ |
| 1498 | + return self._list(_segment.Segment, paginated=False, **query) |
| 1499 | + |
1447 | 1500 | def create_subnet(self, **attrs): |
1448 | 1501 | """Create a new subnet from attributes |
1449 | 1502 |
|
|
0 commit comments