summaryrefslogtreecommitdiff
path: root/keystone_tempest_plugin/services/identity/v3/identity_providers_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'keystone_tempest_plugin/services/identity/v3/identity_providers_client.py')
-rw-r--r--keystone_tempest_plugin/services/identity/v3/identity_providers_client.py102
1 files changed, 0 insertions, 102 deletions
diff --git a/keystone_tempest_plugin/services/identity/v3/identity_providers_client.py b/keystone_tempest_plugin/services/identity/v3/identity_providers_client.py
deleted file mode 100644
index 98f49c7..0000000
--- a/keystone_tempest_plugin/services/identity/v3/identity_providers_client.py
+++ /dev/null
@@ -1,102 +0,0 @@
1# Copyright 2016 Red Hat, Inc.
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 json
16
17import six
18from tempest.lib.common import rest_client
19
20from keystone_tempest_plugin.services.identity import clients
21
22
23class IdentityProvidersClient(clients.Federation):
24
25 subpath_suffix = 'identity_providers'
26
27 def create_identity_provider(self, idp_id, **kwargs):
28 """Create an identity provider.
29
30 :param str idp_id: The ID to be used to create the Identity Provider.
31 :param kwargs: All optional attributes: description (str), enabled
32 (boolean) and remote_ids (list).
33 """
34 put_body = json.dumps({'identity_provider': kwargs})
35 return self._put(idp_id, put_body)
36
37 def list_identity_providers(self):
38 """List the identity providers."""
39 return self._get()
40
41 def show_identity_provider(self, idp_id):
42 """Get an identity provider."""
43 return self._get(idp_id)
44
45 def delete_identity_provider(self, idp_id):
46 """Delete an identity provider."""
47 return self._delete(idp_id)
48
49 def update_identity_provider(self, idp_id, **kwargs):
50 """Update an identity provider.
51
52 :param str idp_id: The ID from the Identity Provider to be updated.
53 :param kwargs: All optional attributes to update: description (str),
54 enabled (boolean) and remote_ids (list).
55 """
56 patch_body = json.dumps({'identity_provider': kwargs})
57 return self._patch(idp_id, patch_body)
58
59 def add_protocol_and_mapping(self, idp_id, protocol_id, mapping_id):
60 """Add a protocol and mapping to an identity provider."""
61 put_body = json.dumps({'protocol': {'mapping_id': mapping_id}})
62 url = '%s/%s/%s' % (
63 self._build_path(entity_id=idp_id), 'protocols', protocol_id)
64 resp, body = self.put(url, put_body)
65 self.expected_success(201, resp.status)
66 body = json.loads(body if six.PY2 else body.decode('utf-8'))
67 return rest_client.ResponseBody(resp, body)
68
69 def delete_protocol_and_mapping(self, idp_id, protocol_id):
70 """Delete a protocol and mapping from an identity provider."""
71 url = '%s/%s/%s' % (
72 self._build_path(entity_id=idp_id), 'protocols', protocol_id)
73 resp, body = self.delete(url)
74 self.expected_success(204, resp.status)
75 return rest_client.ResponseBody(resp, body)
76
77 def get_protocol_and_mapping(self, idp_id, protocol_id):
78 """Get a protocol and mapping from an identity provider."""
79 url = '%s/%s/%s' % (
80 self._build_path(entity_id=idp_id), 'protocols', protocol_id)
81 resp, body = self.get(url)
82 self.expected_success(200, resp.status)
83 body = json.loads(body if six.PY2 else body.decode('utf-8'))
84 return rest_client.ResponseBody(resp, body)
85
86 def list_protocols_and_mappings(self, idp_id):
87 """List the protocols and mappings from an identity provider."""
88 url = '%s/%s' % (self._build_path(entity_id=idp_id), 'protocols')
89 resp, body = self.get(url)
90 self.expected_success(200, resp.status)
91 body = json.loads(body if six.PY2 else body.decode('utf-8'))
92 return rest_client.ResponseBody(resp, body)
93
94 def update_protocol_mapping(self, idp_id, protocol_id, mapping_id):
95 """Update the identity provider protocol with a new mapping."""
96 patch_body = json.dumps({'protocol': {'mapping_id': mapping_id}})
97 url = '%s/%s/%s' % (
98 self._build_path(entity_id=idp_id), 'protocols', protocol_id)
99 resp, body = self.patch(url, patch_body)
100 self.expected_success(200, resp.status)
101 body = json.loads(body if six.PY2 else body.decode('utf-8'))
102 return rest_client.ResponseBody(resp, body)