Kurt Taylor | 6a6f5be | 2013-04-02 18:53:47 -0400 | [diff] [blame] | 1 | # Copyright 2013 IBM Corp. |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 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 | |
Matthew Treinish | 2190551 | 2015-07-13 10:33:35 -0400 | [diff] [blame] | 16 | from oslo_serialization import jsonutils as json |
Matthew Treinish | 8912814 | 2015-04-23 10:44:30 -0400 | [diff] [blame] | 17 | from six.moves.urllib import parse as urllib |
Masayuki Igawa | bfa0760 | 2015-01-20 18:47:17 +0900 | [diff] [blame] | 18 | from tempest_lib import exceptions as lib_exc |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 19 | |
| 20 | from tempest.common import glance_http |
Ken'ichi Ohmichi | 0e83665 | 2015-01-08 04:38:56 +0000 | [diff] [blame] | 21 | from tempest.common import service_client |
Matthew Treinish | 684d899 | 2014-01-30 16:27:40 +0000 | [diff] [blame] | 22 | |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 23 | |
Ken'ichi Ohmichi | 69dcf44 | 2015-11-30 11:48:01 +0000 | [diff] [blame] | 24 | class ImagesClientV2(service_client.ServiceClient): |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 25 | |
Masayuki Igawa | bc7e189 | 2015-03-03 11:46:48 +0900 | [diff] [blame] | 26 | def __init__(self, auth_provider, catalog_type, region, endpoint_type=None, |
| 27 | build_interval=None, build_timeout=None, |
| 28 | disable_ssl_certificate_validation=None, ca_certs=None, |
David Kranz | 85b660b | 2015-03-23 10:26:52 -0400 | [diff] [blame] | 29 | trace_requests=None): |
Ken'ichi Ohmichi | 69dcf44 | 2015-11-30 11:48:01 +0000 | [diff] [blame] | 30 | super(ImagesClientV2, self).__init__( |
Ken'ichi Ohmichi | 0690ea4 | 2015-01-02 07:03:51 +0000 | [diff] [blame] | 31 | auth_provider, |
Masayuki Igawa | bc7e189 | 2015-03-03 11:46:48 +0900 | [diff] [blame] | 32 | catalog_type, |
| 33 | region, |
| 34 | endpoint_type=endpoint_type, |
| 35 | build_interval=build_interval, |
| 36 | build_timeout=build_timeout, |
| 37 | disable_ssl_certificate_validation=( |
| 38 | disable_ssl_certificate_validation), |
| 39 | ca_certs=ca_certs, |
David Kranz | 85b660b | 2015-03-23 10:26:52 -0400 | [diff] [blame] | 40 | trace_requests=trace_requests) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 41 | self._http = None |
Masayuki Igawa | bc7e189 | 2015-03-03 11:46:48 +0900 | [diff] [blame] | 42 | self.dscv = disable_ssl_certificate_validation |
| 43 | self.ca_certs = ca_certs |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 44 | |
| 45 | def _get_http(self): |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 46 | return glance_http.HTTPClient(auth_provider=self.auth_provider, |
| 47 | filters=self.filters, |
Masayuki Igawa | bc7e189 | 2015-03-03 11:46:48 +0900 | [diff] [blame] | 48 | insecure=self.dscv, |
| 49 | ca_certs=self.ca_certs) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 50 | |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 51 | @property |
| 52 | def http(self): |
| 53 | if self._http is None: |
Masayuki Igawa | bc7e189 | 2015-03-03 11:46:48 +0900 | [diff] [blame] | 54 | self._http = self._get_http() |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 55 | return self._http |
| 56 | |
Sergey Nikitin | c6b2ee8 | 2014-02-03 17:13:50 +0400 | [diff] [blame] | 57 | def update_image(self, image_id, patch): |
| 58 | data = json.dumps(patch) |
Sergey Nikitin | c6b2ee8 | 2014-02-03 17:13:50 +0400 | [diff] [blame] | 59 | headers = {"Content-Type": "application/openstack-images-v2.0" |
| 60 | "-json-patch"} |
| 61 | resp, body = self.patch('v2/images/%s' % image_id, data, headers) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 62 | self.expected_success(200, resp.status) |
ghanshyam | 08a73f9 | 2015-08-31 17:32:49 +0900 | [diff] [blame] | 63 | body = json.loads(body) |
| 64 | return service_client.ResponseBody(resp, body) |
Sergey Nikitin | c6b2ee8 | 2014-02-03 17:13:50 +0400 | [diff] [blame] | 65 | |
Matthew Treinish | ce3ef92 | 2013-03-11 14:02:46 -0400 | [diff] [blame] | 66 | def create_image(self, name, container_format, disk_format, **kwargs): |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 67 | params = { |
| 68 | "name": name, |
| 69 | "container_format": container_format, |
| 70 | "disk_format": disk_format, |
| 71 | } |
Matthew Treinish | ce3ef92 | 2013-03-11 14:02:46 -0400 | [diff] [blame] | 72 | |
Sean Dague | c6ec476 | 2014-05-29 08:54:21 -0400 | [diff] [blame] | 73 | for option in kwargs: |
| 74 | value = kwargs.get(option) |
| 75 | if isinstance(value, dict) or isinstance(value, tuple): |
| 76 | params.update(value) |
| 77 | else: |
| 78 | params[option] = value |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 79 | |
| 80 | data = json.dumps(params) |
Valeriy Ponomaryov | 88686d8 | 2014-02-16 12:24:51 +0200 | [diff] [blame] | 81 | resp, body = self.post('v2/images', data) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 82 | self.expected_success(201, resp.status) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 83 | body = json.loads(body) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 84 | return service_client.ResponseBody(resp, body) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 85 | |
bkopilov | 81aaae7 | 2015-05-15 23:46:25 +0300 | [diff] [blame] | 86 | def deactivate_image(self, image_id): |
| 87 | url = 'v2/images/%s/actions/deactivate' % image_id |
| 88 | resp, body = self.post(url, None) |
| 89 | self.expected_success(204, resp.status) |
| 90 | return service_client.ResponseBody(resp, body) |
| 91 | |
| 92 | def reactivate_image(self, image_id): |
| 93 | url = 'v2/images/%s/actions/reactivate' % image_id |
| 94 | resp, body = self.post(url, None) |
| 95 | self.expected_success(204, resp.status) |
| 96 | return service_client.ResponseBody(resp, body) |
| 97 | |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 98 | def delete_image(self, image_id): |
| 99 | url = 'v2/images/%s' % image_id |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 100 | resp, _ = self.delete(url) |
| 101 | self.expected_success(204, resp.status) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 102 | return service_client.ResponseBody(resp) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 103 | |
Ken'ichi Ohmichi | e3acc12 | 2015-05-22 00:32:54 +0000 | [diff] [blame] | 104 | def list_images(self, params=None): |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 105 | url = 'v2/images' |
| 106 | |
| 107 | if params: |
| 108 | url += '?%s' % urllib.urlencode(params) |
| 109 | |
| 110 | resp, body = self.get(url) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 111 | self.expected_success(200, resp.status) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 112 | body = json.loads(body) |
John Warren | f3b3e95 | 2015-08-17 19:28:12 +0000 | [diff] [blame] | 113 | return service_client.ResponseBody(resp, body) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 114 | |
Ken'ichi Ohmichi | 5d41076 | 2015-05-22 01:10:03 +0000 | [diff] [blame] | 115 | def show_image(self, image_id): |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 116 | url = 'v2/images/%s' % image_id |
| 117 | resp, body = self.get(url) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 118 | self.expected_success(200, resp.status) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 119 | body = json.loads(body) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 120 | return service_client.ResponseBody(resp, body) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 121 | |
| 122 | def is_resource_deleted(self, id): |
| 123 | try: |
Ken'ichi Ohmichi | 5d41076 | 2015-05-22 01:10:03 +0000 | [diff] [blame] | 124 | self.show_image(id) |
Masayuki Igawa | bfa0760 | 2015-01-20 18:47:17 +0900 | [diff] [blame] | 125 | except lib_exc.NotFound: |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 126 | return True |
| 127 | return False |
| 128 | |
Matt Riedemann | d2b9651 | 2014-10-13 10:18:16 -0700 | [diff] [blame] | 129 | @property |
| 130 | def resource_type(self): |
| 131 | """Returns the primary type of resource this client works with.""" |
| 132 | return 'image' |
| 133 | |
Ken'ichi Ohmichi | 66494e9 | 2015-06-08 04:28:10 +0000 | [diff] [blame] | 134 | def store_image_file(self, image_id, data): |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 135 | url = 'v2/images/%s/file' % image_id |
| 136 | headers = {'Content-Type': 'application/octet-stream'} |
| 137 | resp, body = self.http.raw_request('PUT', url, headers=headers, |
| 138 | body=data) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 139 | self.expected_success(204, resp.status) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 140 | return service_client.ResponseBody(resp, body) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 141 | |
Ken'ichi Ohmichi | 6bd6f20 | 2015-11-20 05:29:38 +0000 | [diff] [blame] | 142 | def show_image_file(self, image_id): |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 143 | url = 'v2/images/%s/file' % image_id |
| 144 | resp, body = self.get(url) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 145 | self.expected_success(200, resp.status) |
David Kranz | d7e97b4 | 2015-02-16 09:37:31 -0500 | [diff] [blame] | 146 | return service_client.ResponseBodyData(resp, body) |
Anju Tiwari | c495298 | 2013-10-20 07:10:02 +0530 | [diff] [blame] | 147 | |
| 148 | def add_image_tag(self, image_id, tag): |
| 149 | url = 'v2/images/%s/tags/%s' % (image_id, tag) |
Valeriy Ponomaryov | 88686d8 | 2014-02-16 12:24:51 +0200 | [diff] [blame] | 150 | resp, body = self.put(url, body=None) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 151 | self.expected_success(204, resp.status) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 152 | return service_client.ResponseBody(resp, body) |
Anju Tiwari | c495298 | 2013-10-20 07:10:02 +0530 | [diff] [blame] | 153 | |
| 154 | def delete_image_tag(self, image_id, tag): |
| 155 | url = 'v2/images/%s/tags/%s' % (image_id, tag) |
| 156 | resp, _ = self.delete(url) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 157 | self.expected_success(204, resp.status) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 158 | return service_client.ResponseBody(resp) |
Attila Fazekas | 689e265 | 2013-10-07 18:06:57 +0200 | [diff] [blame] | 159 | |
Ken'ichi Ohmichi | f0df53c | 2015-05-22 01:16:50 +0000 | [diff] [blame] | 160 | def list_image_members(self, image_id): |
Attila Fazekas | 689e265 | 2013-10-07 18:06:57 +0200 | [diff] [blame] | 161 | url = 'v2/images/%s/members' % image_id |
| 162 | resp, body = self.get(url) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 163 | self.expected_success(200, resp.status) |
Attila Fazekas | 689e265 | 2013-10-07 18:06:57 +0200 | [diff] [blame] | 164 | body = json.loads(body) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 165 | return service_client.ResponseBody(resp, body) |
Attila Fazekas | 689e265 | 2013-10-07 18:06:57 +0200 | [diff] [blame] | 166 | |
Ken'ichi Ohmichi | 9dacbe0 | 2015-11-30 12:01:39 +0000 | [diff] [blame] | 167 | def create_image_member(self, image_id, **kwargs): |
| 168 | """Create an image member. |
| 169 | |
| 170 | Available params: see http://developer.openstack.org/ |
| 171 | api-ref-image-v2.html#createImageMember-v2 |
| 172 | """ |
Attila Fazekas | 689e265 | 2013-10-07 18:06:57 +0200 | [diff] [blame] | 173 | url = 'v2/images/%s/members' % image_id |
Ken'ichi Ohmichi | 2f8f6c2 | 2015-11-24 02:28:52 +0000 | [diff] [blame] | 174 | data = json.dumps(kwargs) |
Valeriy Ponomaryov | 88686d8 | 2014-02-16 12:24:51 +0200 | [diff] [blame] | 175 | resp, body = self.post(url, data) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 176 | self.expected_success(200, resp.status) |
Attila Fazekas | 689e265 | 2013-10-07 18:06:57 +0200 | [diff] [blame] | 177 | body = json.loads(body) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 178 | return service_client.ResponseBody(resp, body) |
Attila Fazekas | 689e265 | 2013-10-07 18:06:57 +0200 | [diff] [blame] | 179 | |
Ken'ichi Ohmichi | 2f8f6c2 | 2015-11-24 02:28:52 +0000 | [diff] [blame] | 180 | def update_image_member(self, image_id, member_id, **kwargs): |
Ken'ichi Ohmichi | 5a1c934 | 2015-11-30 12:12:19 +0000 | [diff] [blame] | 181 | """Update an image member. |
| 182 | |
| 183 | Available params: see http://developer.openstack.org/ |
| 184 | api-ref-image-v2.html#updateImageMember-v2 |
| 185 | """ |
Attila Fazekas | 689e265 | 2013-10-07 18:06:57 +0200 | [diff] [blame] | 186 | url = 'v2/images/%s/members/%s' % (image_id, member_id) |
Ken'ichi Ohmichi | 2f8f6c2 | 2015-11-24 02:28:52 +0000 | [diff] [blame] | 187 | data = json.dumps(kwargs) |
Valeriy Ponomaryov | 88686d8 | 2014-02-16 12:24:51 +0200 | [diff] [blame] | 188 | resp, body = self.put(url, data) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 189 | self.expected_success(200, resp.status) |
Attila Fazekas | 689e265 | 2013-10-07 18:06:57 +0200 | [diff] [blame] | 190 | body = json.loads(body) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 191 | return service_client.ResponseBody(resp, body) |
Sergey Nikitin | c6b2ee8 | 2014-02-03 17:13:50 +0400 | [diff] [blame] | 192 | |
Ken'ichi Ohmichi | c3728c6 | 2015-06-08 04:01:45 +0000 | [diff] [blame] | 193 | def show_image_member(self, image_id, member_id): |
Sergey Nikitin | c6b2ee8 | 2014-02-03 17:13:50 +0400 | [diff] [blame] | 194 | url = 'v2/images/%s/members/%s' % (image_id, member_id) |
| 195 | resp, body = self.get(url) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 196 | self.expected_success(200, resp.status) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 197 | return service_client.ResponseBody(resp, json.loads(body)) |
Sergey Nikitin | c6b2ee8 | 2014-02-03 17:13:50 +0400 | [diff] [blame] | 198 | |
Ken'ichi Ohmichi | b8461cb | 2015-11-20 08:10:51 +0000 | [diff] [blame] | 199 | def delete_image_member(self, image_id, member_id): |
Sergey Nikitin | c6b2ee8 | 2014-02-03 17:13:50 +0400 | [diff] [blame] | 200 | url = 'v2/images/%s/members/%s' % (image_id, member_id) |
| 201 | resp, _ = self.delete(url) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 202 | self.expected_success(204, resp.status) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 203 | return service_client.ResponseBody(resp) |
raiesmh08 | a1ce354 | 2014-03-04 11:58:29 +0530 | [diff] [blame] | 204 | |
Ken'ichi Ohmichi | 66494e9 | 2015-06-08 04:28:10 +0000 | [diff] [blame] | 205 | def show_schema(self, schema): |
raiesmh08 | a1ce354 | 2014-03-04 11:58:29 +0530 | [diff] [blame] | 206 | url = 'v2/schemas/%s' % schema |
| 207 | resp, body = self.get(url) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 208 | self.expected_success(200, resp.status) |
raiesmh08 | a1ce354 | 2014-03-04 11:58:29 +0530 | [diff] [blame] | 209 | body = json.loads(body) |
Ken'ichi Ohmichi | a6ac242 | 2015-01-13 01:09:39 +0000 | [diff] [blame] | 210 | return service_client.ResponseBody(resp, body) |
piyush110786 | 5f829d7 | 2015-09-11 11:46:35 +0530 | [diff] [blame] | 211 | |
| 212 | def list_resource_types(self): |
| 213 | url = '/v2/metadefs/resource_types' |
| 214 | resp, body = self.get(url) |
| 215 | self.expected_success(200, resp.status) |
| 216 | body = json.loads(body) |
| 217 | return service_client.ResponseBody(resp, body) |
| 218 | |
Ken'ichi Ohmichi | 2f8f6c2 | 2015-11-24 02:28:52 +0000 | [diff] [blame] | 219 | def create_namespace(self, **kwargs): |
| 220 | """Create a namespace. |
piyush110786 | 5f829d7 | 2015-09-11 11:46:35 +0530 | [diff] [blame] | 221 | |
Ken'ichi Ohmichi | 2f8f6c2 | 2015-11-24 02:28:52 +0000 | [diff] [blame] | 222 | Available params: see http://developer.openstack.org/ |
| 223 | api-ref-image-v2.html#createNamespace-v2 |
| 224 | """ |
| 225 | data = json.dumps(kwargs) |
piyush110786 | 5f829d7 | 2015-09-11 11:46:35 +0530 | [diff] [blame] | 226 | resp, body = self.post('/v2/metadefs/namespaces', data) |
| 227 | self.expected_success(201, resp.status) |
| 228 | body = json.loads(body) |
| 229 | return service_client.ResponseBody(resp, body) |
| 230 | |
Ken'ichi Ohmichi | 1951563 | 2015-11-24 02:08:24 +0000 | [diff] [blame] | 231 | def show_namespace(self, namespace): |
piyush110786 | 5f829d7 | 2015-09-11 11:46:35 +0530 | [diff] [blame] | 232 | url = '/v2/metadefs/namespaces/%s' % namespace |
| 233 | resp, body = self.get(url) |
| 234 | self.expected_success(200, resp.status) |
| 235 | body = json.loads(body) |
| 236 | return service_client.ResponseBody(resp, body) |
| 237 | |
Ken'ichi Ohmichi | 2f8f6c2 | 2015-11-24 02:28:52 +0000 | [diff] [blame] | 238 | def update_namespace(self, namespace, **kwargs): |
| 239 | """Update a namespace. |
piyush110786 | 5f829d7 | 2015-09-11 11:46:35 +0530 | [diff] [blame] | 240 | |
Ken'ichi Ohmichi | 2f8f6c2 | 2015-11-24 02:28:52 +0000 | [diff] [blame] | 241 | Available params: see http://developer.openstack.org/ |
| 242 | api-ref-image-v2.html#updateNamespace-v2 |
| 243 | """ |
| 244 | # NOTE: On Glance API, we need to pass namespace on both URI |
| 245 | # and a request body. |
| 246 | params = {'namespace': namespace} |
| 247 | params.update(kwargs) |
piyush110786 | 5f829d7 | 2015-09-11 11:46:35 +0530 | [diff] [blame] | 248 | data = json.dumps(params) |
piyush110786 | 5f829d7 | 2015-09-11 11:46:35 +0530 | [diff] [blame] | 249 | url = '/v2/metadefs/namespaces/%s' % namespace |
| 250 | resp, body = self.put(url, body=data) |
| 251 | self.expected_success(200, resp.status) |
| 252 | body = json.loads(body) |
| 253 | return service_client.ResponseBody(resp, body) |
| 254 | |
Ken'ichi Ohmichi | 1951563 | 2015-11-24 02:08:24 +0000 | [diff] [blame] | 255 | def delete_namespace(self, namespace): |
piyush110786 | 5f829d7 | 2015-09-11 11:46:35 +0530 | [diff] [blame] | 256 | url = '/v2/metadefs/namespaces/%s' % namespace |
| 257 | resp, _ = self.delete(url) |
| 258 | self.expected_success(204, resp.status) |
| 259 | return service_client.ResponseBody(resp) |