blob: c956e27f9e3c2ea203d6d482f50d485fd10b3aee [file] [log] [blame]
Nikhil Manchandadd6886f2014-03-03 01:58:45 -08001# Copyright 2014 OpenStack Foundation
2# All Rights Reserved.
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
Masayuki Igawa8648bae2014-03-10 11:05:54 +090016import urllib
17
Ken'ichi Ohmichi0e836652015-01-08 04:38:56 +000018from tempest.common import service_client
Nikhil Manchandadd6886f2014-03-03 01:58:45 -080019
20
Ken'ichi Ohmichi0e836652015-01-08 04:38:56 +000021class DatabaseFlavorsClientJSON(service_client.ServiceClient):
Nikhil Manchandadd6886f2014-03-03 01:58:45 -080022
Nikhil Manchandadd6886f2014-03-03 01:58:45 -080023 def list_db_flavors(self, params=None):
24 url = 'flavors'
25 if params:
26 url += '?%s' % urllib.urlencode(params)
27
28 resp, body = self.get(url)
Swapnil Kulkarni59c7f9b2014-08-20 14:55:23 +000029 self.expected_success(200, resp.status)
David Kranzb728df72015-02-18 13:40:29 -050030 return service_client.ResponseBodyList(resp, self._parse_resp(body))
Nikhil Manchandadd6886f2014-03-03 01:58:45 -080031
32 def get_db_flavor_details(self, db_flavor_id):
33 resp, body = self.get("flavors/%s" % str(db_flavor_id))
Swapnil Kulkarni59c7f9b2014-08-20 14:55:23 +000034 self.expected_success(200, resp.status)
David Kranzb728df72015-02-18 13:40:29 -050035 return service_client.ResponseBody(resp, self._parse_resp(body))