diff options
author | openstack <neha.alhat@nttdata.com> | 2018-10-22 08:46:47 +0000 |
---|---|---|
committer | openstack <neha.alhat@nttdata.com> | 2018-10-22 10:35:03 +0000 |
commit | e7621bddc16de6371a05567a8ab23e7ccd67fba7 (patch) | |
tree | 8ce70f4b4befe26afd04ed14084c784011efcd2d /keystoneclient/v3 | |
parent | 8982841b637b1ce64af5134b628df515ab6d3afa (diff) | |
download | python-keystoneclient-e7621bddc16de6371a05567a8ab23e7ccd67fba7.tar.gz |
Add return-request-id-to-caller function(v3/contrib)
Added return-request-id-to-caller function tovresources and resource
managers in the following files.
* keystoneclient/v3/contrib/simple_cert.py
* keystoneclient/v3/contrib/endpoint_policy.py
* keystoneclient/v3/contrib/oauth1/access_tokens.py
* keystoneclient/v3/contrib/oauth1/request_tokens.py
Adding request-id to below V3 contrib API's is covered in base patch
[1] but this patch is specifically for V3 API's so covered their test
cases in this patch.
* keystoneclient/v3/contrib/endpoint_filter.py
* keystoneclient/v3/contrib/federation/identity_providers.py
* keystoneclient/v3/contrib/federation/mappings.py
* keystoneclient/v3/contrib/federation/protocols.py
* keystoneclient/v3/contrib/federation/service_providers.py
The methods in the resource class and resource manager return
a 'base.Response' class that has 'request_ids' property.
The caller can get request ids of the callee via that property.
[1] https://review.openstack.org/#/c/329913
Change-Id: I5f90c31020e0dd672a160c7b587f41ba8f2b596c
Co-authored-by: Dinesh Bhor <dinesh.bhor@nttdata.com>
Co-authored-by: Ankit Agrawal <ankit11.agrawal@nttdata.com>
Co-authored-by: Neha Alhat <neha.alhat@nttdata.com>
Implements: blueprint return-request-id-to-caller
Diffstat (limited to 'keystoneclient/v3')
-rw-r--r-- | keystoneclient/v3/contrib/endpoint_policy.py | 25 | ||||
-rw-r--r-- | keystoneclient/v3/contrib/oauth1/access_tokens.py | 3 | ||||
-rw-r--r-- | keystoneclient/v3/contrib/oauth1/request_tokens.py | 3 | ||||
-rw-r--r-- | keystoneclient/v3/contrib/simple_cert.py | 7 |
4 files changed, 22 insertions, 16 deletions
diff --git a/keystoneclient/v3/contrib/endpoint_policy.py b/keystoneclient/v3/contrib/endpoint_policy.py index 24148c1..c65b1fb 100644 --- a/keystoneclient/v3/contrib/endpoint_policy.py +++ b/keystoneclient/v3/contrib/endpoint_policy.py @@ -39,17 +39,17 @@ class EndpointPolicyManager(base.Manager): def create_policy_association_for_endpoint(self, policy, endpoint): """Create an association between a policy and an endpoint.""" - self._act_on_policy_association_for_endpoint( + return self._act_on_policy_association_for_endpoint( policy, endpoint, self._put) def check_policy_association_for_endpoint(self, policy, endpoint): """Check an association between a policy and an endpoint.""" - self._act_on_policy_association_for_endpoint( + return self._act_on_policy_association_for_endpoint( policy, endpoint, self._head) def delete_policy_association_for_endpoint(self, policy, endpoint): """Delete an association between a policy and an endpoint.""" - self._act_on_policy_association_for_endpoint( + return self._act_on_policy_association_for_endpoint( policy, endpoint, self._delete) def _act_on_policy_association_for_service(self, policy, service, action): @@ -67,17 +67,17 @@ class EndpointPolicyManager(base.Manager): def create_policy_association_for_service(self, policy, service): """Create an association between a policy and a service.""" - self._act_on_policy_association_for_service( + return self._act_on_policy_association_for_service( policy, service, self._put) def check_policy_association_for_service(self, policy, service): """Check an association between a policy and a service.""" - self._act_on_policy_association_for_service( + return self._act_on_policy_association_for_service( policy, service, self._head) def delete_policy_association_for_service(self, policy, service): """Delete an association between a policy and a service.""" - self._act_on_policy_association_for_service( + return self._act_on_policy_association_for_service( policy, service, self._delete) def _act_on_policy_association_for_region_and_service( @@ -99,19 +99,19 @@ class EndpointPolicyManager(base.Manager): def create_policy_association_for_region_and_service( self, policy, region, service): """Create an association between a policy and a service in a region.""" - self._act_on_policy_association_for_region_and_service( + return self._act_on_policy_association_for_region_and_service( policy, region, service, self._put) def check_policy_association_for_region_and_service( self, policy, region, service): """Check an association between a policy and a service in a region.""" - self._act_on_policy_association_for_region_and_service( + return self._act_on_policy_association_for_region_and_service( policy, region, service, self._head) def delete_policy_association_for_region_and_service( self, policy, region, service): """Delete an association between a policy and a service in a region.""" - self._act_on_policy_association_for_region_and_service( + return self._act_on_policy_association_for_region_and_service( policy, region, service, self._delete) def get_policy_for_endpoint(self, endpoint): @@ -130,9 +130,10 @@ class EndpointPolicyManager(base.Manager): 'endpoint_id': endpoint_id, 'ext_name': self.OS_EP_POLICY_EXT} - _resp, body = self.client.get(url) - return policies.Policy( - self, body[policies.PolicyManager.key], loaded=True) + resp, body = self.client.get(url) + return self._prepare_return_value( + resp, policies.Policy(self, body[policies.PolicyManager.key], + loaded=True)) def list_endpoints_for_policy(self, policy): """List endpoints with the effective association to a policy. diff --git a/keystoneclient/v3/contrib/oauth1/access_tokens.py b/keystoneclient/v3/contrib/oauth1/access_tokens.py index 37f1941..b32eaf3 100644 --- a/keystoneclient/v3/contrib/oauth1/access_tokens.py +++ b/keystoneclient/v3/contrib/oauth1/access_tokens.py @@ -48,4 +48,5 @@ class AccessTokenManager(base.CrudManager): http_method='POST') resp, body = self.client.post(endpoint, headers=headers) token = utils.get_oauth_token_from_body(resp.content) - return self.resource_class(self, token) + return self._prepare_return_value(resp, + self.resource_class(self, token)) diff --git a/keystoneclient/v3/contrib/oauth1/request_tokens.py b/keystoneclient/v3/contrib/oauth1/request_tokens.py index 59f06bc..0efe2de 100644 --- a/keystoneclient/v3/contrib/oauth1/request_tokens.py +++ b/keystoneclient/v3/contrib/oauth1/request_tokens.py @@ -70,4 +70,5 @@ class RequestTokenManager(base.CrudManager): headers=headers) resp, body = self.client.post(endpoint, headers=headers) token = utils.get_oauth_token_from_body(resp.content) - return self.resource_class(self, token) + return self._prepare_return_value(resp, + self.resource_class(self, token)) diff --git a/keystoneclient/v3/contrib/simple_cert.py b/keystoneclient/v3/contrib/simple_cert.py index 8168e67..6b58b27 100644 --- a/keystoneclient/v3/contrib/simple_cert.py +++ b/keystoneclient/v3/contrib/simple_cert.py @@ -11,12 +11,15 @@ # License for the specific language governing permissions and limitations # under the License. +from keystoneclient import base + class SimpleCertManager(object): """Manager for the OS-SIMPLE-CERT extension.""" def __init__(self, client): self._client = client + self.mgr = base.Manager(self._client) def get_ca_certificates(self): """Get CA certificates. @@ -27,7 +30,7 @@ class SimpleCertManager(object): """ resp, body = self._client.get('/OS-SIMPLE-CERT/ca', authenticated=False) - return resp.text + return self.mgr._prepare_return_value(resp, resp.text) def get_certificates(self): """Get signing certificates. @@ -38,4 +41,4 @@ class SimpleCertManager(object): """ resp, body = self._client.get('/OS-SIMPLE-CERT/certificates', authenticated=False) - return resp.text + return self.mgr._prepare_return_value(resp, resp.text) |