Sean Dague | 556add5 | 2013-07-19 14:28:44 -0400 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 | # not use this file except in compliance with the License. You may obtain |
| 3 | # a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | # |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | # License for the specific language governing permissions and limitations |
| 11 | # under the License. |
| 12 | |
Matthew Treinish | 2190551 | 2015-07-13 10:33:35 -0400 | [diff] [blame] | 13 | from oslo_serialization import jsonutils as json |
chris fattarsi | 8ed39ac | 2012-04-30 14:11:27 -0700 | [diff] [blame] | 14 | |
Ken'ichi Ohmichi | 0e83665 | 2015-01-08 04:38:56 +0000 | [diff] [blame] | 15 | from tempest.common import service_client |
Matthew Treinish | 684d899 | 2014-01-30 16:27:40 +0000 | [diff] [blame] | 16 | |
chris fattarsi | 8ed39ac | 2012-04-30 14:11:27 -0700 | [diff] [blame] | 17 | |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 18 | class IdentityClient(service_client.ServiceClient): |
Ralf Haferkamp | d5525e3 | 2015-06-19 17:17:47 +0200 | [diff] [blame] | 19 | api_version = "v2.0" |
chris fattarsi | 8ed39ac | 2012-04-30 14:11:27 -0700 | [diff] [blame] | 20 | |
Ken'ichi Ohmichi | 402b875 | 2015-11-09 10:47:16 +0000 | [diff] [blame] | 21 | def show_api_description(self): |
Filip Hubík | 8135405 | 2015-03-09 19:04:23 +0100 | [diff] [blame] | 22 | """Retrieves info about the v2.0 Identity API""" |
| 23 | url = '' |
| 24 | resp, body = self.get(url) |
| 25 | self.expected_success([200, 203], resp.status) |
Anusha Ramineni | 0cfb461 | 2015-08-24 08:49:10 +0530 | [diff] [blame] | 26 | body = json.loads(body) |
| 27 | return service_client.ResponseBody(resp, body) |
Filip Hubík | 8135405 | 2015-03-09 19:04:23 +0100 | [diff] [blame] | 28 | |
Ken'ichi Ohmichi | 402b875 | 2015-11-09 10:47:16 +0000 | [diff] [blame] | 29 | def show_token(self, token_id): |
Zhi Kun Liu | 30caeae | 2014-02-26 15:30:24 +0800 | [diff] [blame] | 30 | """Get token details.""" |
| 31 | resp, body = self.get("tokens/%s" % token_id) |
David Kranz | e9d2f42 | 2014-07-02 13:57:41 -0400 | [diff] [blame] | 32 | self.expected_success(200, resp.status) |
Anusha Ramineni | 0cfb461 | 2015-08-24 08:49:10 +0530 | [diff] [blame] | 33 | body = json.loads(body) |
| 34 | return service_client.ResponseBody(resp, body) |
Zhi Kun Liu | 30caeae | 2014-02-26 15:30:24 +0800 | [diff] [blame] | 35 | |
Rohit Karajgi | 6b1e154 | 2012-05-14 05:55:54 -0700 | [diff] [blame] | 36 | def delete_token(self, token_id): |
Sean Dague | f237ccb | 2013-01-04 15:19:14 -0500 | [diff] [blame] | 37 | """Delete a token.""" |
David Kranz | e9d2f42 | 2014-07-02 13:57:41 -0400 | [diff] [blame] | 38 | resp, body = self.delete("tokens/%s" % token_id) |
| 39 | self.expected_success(204, resp.status) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 40 | return service_client.ResponseBody(resp, body) |
Rohit Karajgi | 6b1e154 | 2012-05-14 05:55:54 -0700 | [diff] [blame] | 41 | |
Abhijeet.Jain | 3f49b84 | 2014-05-20 12:06:20 +0530 | [diff] [blame] | 42 | def list_extensions(self): |
| 43 | """List all the extensions.""" |
| 44 | resp, body = self.get('/extensions') |
David Kranz | e9d2f42 | 2014-07-02 13:57:41 -0400 | [diff] [blame] | 45 | self.expected_success(200, resp.status) |
Abhijeet.Jain | 3f49b84 | 2014-05-20 12:06:20 +0530 | [diff] [blame] | 46 | body = json.loads(body) |
Anusha Ramineni | 0cfb461 | 2015-08-24 08:49:10 +0530 | [diff] [blame] | 47 | return service_client.ResponseBody(resp, body) |