Debian Codegraph @

octavia_tempest_plugin/services/load_balancer/v2/flavor_capabilities_client.py

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