|
29 | 29 | from openstack.network.v2 import router as _router |
30 | 30 | from openstack.network.v2 import security_group as _security_group |
31 | 31 | from openstack.network.v2 import security_group_rule as _security_group_rule |
| 32 | +from openstack.network.v2 import segment as _segment |
32 | 33 | from openstack.network.v2 import subnet as _subnet |
33 | 34 | from openstack.network.v2 import subnet_pool as _subnet_pool |
34 | 35 | from openstack.network.v2 import vpn_service as _vpn_service |
@@ -1498,6 +1499,58 @@ def security_group_rules(self, **query): |
1498 | 1499 | return self._list(_security_group_rule.SecurityGroupRule, |
1499 | 1500 | paginated=False, **query) |
1500 | 1501 |
|
| 1502 | + def find_segment(self, name_or_id, ignore_missing=True): |
| 1503 | + """Find a single segment |
| 1504 | +
|
| 1505 | + .. caution:: |
| 1506 | + BETA: This API is a work in progress and is subject to change. |
| 1507 | +
|
| 1508 | + :param name_or_id: The name or ID of a segment. |
| 1509 | + :param bool ignore_missing: When set to ``False`` |
| 1510 | + :class:`~openstack.exceptions.ResourceNotFound` will be |
| 1511 | + raised when the resource does not exist. |
| 1512 | + When set to ``True``, None will be returned when |
| 1513 | + attempting to find a nonexistent resource. |
| 1514 | + :returns: One :class:`~openstack.network.v2.segment.Segment` or None |
| 1515 | + """ |
| 1516 | + return self._find(_segment.Segment, name_or_id, |
| 1517 | + ignore_missing=ignore_missing) |
| 1518 | + |
| 1519 | + def get_segment(self, segment): |
| 1520 | + """Get a single segment |
| 1521 | +
|
| 1522 | + .. caution:: |
| 1523 | + BETA: This API is a work in progress and is subject to change. |
| 1524 | +
|
| 1525 | + :param segment: The value can be the ID of a segment or a |
| 1526 | + :class:`~openstack.network.v2.segment.Segment` |
| 1527 | + instance. |
| 1528 | +
|
| 1529 | + :returns: One :class:`~openstack.network.v2.segment.Segment` |
| 1530 | + :raises: :class:`~openstack.exceptions.ResourceNotFound` |
| 1531 | + when no resource can be found. |
| 1532 | + """ |
| 1533 | + return self._get(_segment.Segment, segment) |
| 1534 | + |
| 1535 | + def segments(self, **query): |
| 1536 | + """Return a generator of segments |
| 1537 | +
|
| 1538 | + .. caution:: |
| 1539 | + BETA: This API is a work in progress and is subject to change. |
| 1540 | +
|
| 1541 | + :param kwargs \*\*query: Optional query parameters to be sent to limit |
| 1542 | + the resources being returned. Available parameters include: |
| 1543 | +
|
| 1544 | + * network_id: ID of the network that owns the segments |
| 1545 | + * network_type: Network type for the segments |
| 1546 | + * physical_network: Physical network name for the segments |
| 1547 | + * segmentation_id: Segmentation ID for the segments |
| 1548 | +
|
| 1549 | + :returns: A generator of segment objects |
| 1550 | + :rtype: :class:`~openstack.network.v2.segment.Segment` |
| 1551 | + """ |
| 1552 | + return self._list(_segment.Segment, paginated=False, **query) |
| 1553 | + |
1501 | 1554 | def create_subnet(self, **attrs): |
1502 | 1555 | """Create a new subnet from attributes |
1503 | 1556 |
|
|
0 commit comments