blob: 29c3fb0fedcf29ed52fc012f8aa4229d991df634 [file] [log] [blame]
Ken'ichi Ohmichi4adae2f2017-03-15 15:47:44 -07001# Copyright 2017 NEC Corporation. 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
15import time
16
17from oslo_serialization import jsonutils as json
18
19from tempest.lib.api_schema.response.volume import versions as schema
20from tempest.lib.common import rest_client
zhufl02736522017-06-19 13:57:28 +080021from tempest.lib.services.volume import base_client
Ken'ichi Ohmichi4adae2f2017-03-15 15:47:44 -070022
23
24class VersionsClient(base_client.BaseClient):
Ken'ichi Ohmichi4adae2f2017-03-15 15:47:44 -070025
26 def list_versions(self):
27 """List API versions
28
29 For a full list of available parameters, please refer to the official
30 API reference:
Andreas Jaegerbf30ae72019-07-22 19:22:57 +020031 https://docs.openstack.org/api-ref/block-storage/v3/#list-all-api-versions
Ken'ichi Ohmichi4adae2f2017-03-15 15:47:44 -070032 """
33 version_url = self._get_base_version_url()
34
35 start = time.time()
36 resp, body = self.raw_request(version_url, 'GET')
37 end = time.time()
38 # NOTE: We need a raw_request() here instead of request() call because
39 # "list API versions" API doesn't require an authentication and we can
40 # skip it with raw_request() call.
41 self._log_request('GET', version_url, resp, secs=(end - start),
42 resp_body=body)
43 self._error_checker(resp, body)
44
45 body = json.loads(body)
46 self.validate_response(schema.list_versions, resp, body)
47 return rest_client.ResponseBody(resp, body)