blob: 21bc37a5cb4b4a6e6b7912a00d3fa919c02cad8e [file] [log] [blame]
Matthew Treinish9e26ca82016-02-23 11:43:20 -05001# Copyright 2014 NEC Corporation.
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
15from oslo_serialization import jsonutils as json
16from six.moves.urllib import parse as urllib
17
18from tempest.lib.api_schema.response.compute.v2_1 import migrations as schema
19from tempest.lib.common import rest_client
20
21
22class MigrationsClient(rest_client.RestClient):
23
24 def list_migrations(self, **params):
25 """List all migrations.
26
27 Available params: see http://developer.openstack.org/
28 api-ref-compute-v2.1.html#returnmigrations
29 """
30
31 url = 'os-migrations'
32 if params:
33 url += '?%s' % urllib.urlencode(params)
34
35 resp, body = self.get(url)
36 body = json.loads(body)
37 self.validate_response(schema.list_migrations, resp, body)
38 return rest_client.ResponseBody(resp, body)