Debian Codegraph @

octavia_tempest_plugin/services/load_balancer/v2/availability_zone_capabilities_client.py

raw symbols SCIP
1 # Copyright 2019 Rackspace US Inc. All rights reserved.
2 # Copyright 2019 Verizon Media
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15 #
16
17 from octavia_tempest_plugin.common.decorators import skip_if_not_implemented
18 from octavia_tempest_plugin.services.load_balancer.v2 import base_client
19 from octavia_tempest_plugin.services.load_balancer.v2 import provider_client
20
21 Unset = base_client.Unset
22
23
24 class AvailabilityZoneCapabilitiesClient(base_client.BaseLBaaSClient):
25
26 list_root_tag = 'availability_zone_capabilities'
27
28 def __init__(self, *args, **kwargs):
29 super(AvailabilityZoneCapabilitiesClient, self).__init__(
30 *args, **kwargs)
31 providers_list_root_tag = provider_client.ProviderClient.list_root_tag
32 # /v2.0/lbaas/providers/<PROVIDER_UUID>/availability_zone_capabilities
33 self.uri = "{provider_base_uri}/{parent}/{object}".format(
34 provider_base_uri=self.base_uri.format(
35 object=providers_list_root_tag),
36 parent="{parent}",
37 object=self.list_root_tag
38 )
39
40 @skip_if_not_implemented
41 def list_availability_zone_capabilities(self, provider, query_params=None,
42 return_object_only=True):
43 """Get a list of provider availability zone capability objects.
44
45 :param provider: The provider to query for availability zone
46 capabilities.
47 :param query_params: The optional query parameters to append to the
48 request. Ex. fields=id&fields=name
49 :param return_object_only: If True, the response returns the object
50 inside the root tag. False returns the full
51 response from the API.
52 :raises AssertionError: if the expected_code isn't a valid http success
53 response code
54 :raises BadRequest: If a 400 response code is received
55 :raises Conflict: If a 409 response code is received
56 :raises Forbidden: If a 403 response code is received
57 :raises Gone: If a 410 response code is received
58 :raises InvalidContentType: If a 415 response code is received
59 :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
60 :raises InvalidHttpSuccessCode: if the read code isn't an expected
61 http success code
62 :raises NotFound: If a 404 response code is received
63 :raises NotImplemented: If a 501 response code is received
64 :raises OverLimit: If a 413 response code is received and over_limit is
65 not in the response body
66 :raises RateLimitExceeded: If a 413 response code is received and
67 over_limit is in the response body
68 :raises ServerFault: If a 500 response code is received
69 :raises Unauthorized: If a 401 response code is received
70 :raises UnexpectedContentType: If the content-type of the response
71 isn't an expect type
72 :raises UnexpectedResponseCode: If a response code above 400 is
73 received and it doesn't fall into any
74 of the handled checks
75 :raises UnprocessableEntity: If a 422 response code is received and
76 couldn't be parsed
77 :returns: A list of availability zone capability objects.
78 """
79 return self._list_objects(parent_id=provider,
80 query_params=query_params,
81 return_object_only=return_object_only)