diff options
author | Zuul <zuul@review.opendev.org> | 2020-06-03 08:20:46 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2020-06-03 08:20:46 +0000 |
commit | fe61e8a25c560e886f1ce505bada5c2c1eaa935d (patch) | |
tree | a57016827805ba1ef4514477ea96625bf410e40b | |
parent | 3cfa54fa56674362ffbbbd3199e6be3c0e4ffbb9 (diff) | |
parent | 626970a353c158158173dac0730cf1204fcf2f11 (diff) | |
download | python-neutronclient-fe61e8a25c560e886f1ce505bada5c2c1eaa935d.tar.gz |
Merge "Add segments client code"
-rw-r--r-- | neutronclient/v2_0/client.py | 25 | ||||
-rw-r--r-- | releasenotes/notes/segments-8557f5b0caa5ee26.yaml | 5 |
2 files changed, 30 insertions, 0 deletions
diff --git a/neutronclient/v2_0/client.py b/neutronclient/v2_0/client.py index 13f90e4..ff44064 100644 --- a/neutronclient/v2_0/client.py +++ b/neutronclient/v2_0/client.py @@ -515,6 +515,8 @@ class Client(ClientBase): security_group_path = "/security-groups/%s" security_group_rules_path = "/security-group-rules" security_group_rule_path = "/security-group-rules/%s" + segments_path = "/segments" + segment_path = "/segments/%s" sfc_flow_classifiers_path = "/sfc/flow_classifiers" sfc_flow_classifier_path = "/sfc/flow_classifiers/%s" @@ -668,6 +670,7 @@ class Client(ClientBase): 'service_definitions': 'service_definition', 'security_groups': 'security_group', 'security_group_rules': 'security_group_rule', + 'segments': 'segment', 'ipsecpolicies': 'ipsecpolicy', 'ikepolicies': 'ikepolicy', 'ipsec_site_connections': 'ipsec_site_connection', @@ -1047,6 +1050,28 @@ class Client(ClientBase): return self.get(self.security_group_rule_path % (security_group_rule), params=_params) + def create_segment(self, body=None): + """Creates a new segment.""" + return self.post(self.segments_path, body=body) + + def update_segment(self, segment, body=None, revision_number=None): + """Updates a segment.""" + return self._update_resource(self.segment_path % segment, body=body, + revision_number=revision_number) + + def list_segments(self, retrieve_all=True, **_params): + """Fetches a list of all segments for a project.""" + return self.list('segments', self.segments_path, retrieve_all, + **_params) + + def show_segment(self, segment, **_params): + """Fetches information of a certain segment.""" + return self.get(self.segment_path % segment, params=_params) + + def delete_segment(self, segment): + """Deletes the specified segment.""" + return self.delete(self.segment_path % segment) + def list_endpoint_groups(self, retrieve_all=True, **_params): """Fetches a list of all VPN endpoint groups for a project.""" return self.list('endpoint_groups', self.endpoint_groups_path, diff --git a/releasenotes/notes/segments-8557f5b0caa5ee26.yaml b/releasenotes/notes/segments-8557f5b0caa5ee26.yaml new file mode 100644 index 0000000..292adf8 --- /dev/null +++ b/releasenotes/notes/segments-8557f5b0caa5ee26.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + New client methods: ``create_segment``, ``update_segment``, + ``list_segments``, ``show_segment`` and ``delete_segment``. |