async def get_o_auth_2_claim(self, authServerId, claimId): """ Args: auth_server_id {str} claim_id {str} Returns: OAuth2Claim """ http_method = "get".upper() api_url = format_url(f""" {self._base_url} /api/v1/authorizationServers/{authServerId}/claims /{claimId} """) body = {} headers = {} request, error = await self._request_executor.create_request( http_method, api_url, body, headers) if error: return (None, None, error) response, error = await self._request_executor\ .execute(request, OAuth2Claim) if error: return (None, response, error) try: result = OAuth2Claim(self.form_response_body(response.get_body())) except Exception as error: return (None, response, error) return (result, response, None)
async def list_o_auth_2_claims(self, authServerId): """ Args: auth_server_id {str} Returns: list: Collection of OAuth2Claim instances. """ http_method = "get".upper() api_url = format_url(f""" {self._base_url} /api/v1/authorizationServers/{authServerId}/claims """) body = {} headers = {} request, error = await self._request_executor.create_request( http_method, api_url, body, headers) if error: return (None, None, error) response, error = await self._request_executor\ .execute(request, OAuth2Claim) if error: return (None, response, error) try: result = [] for item in response.get_body(): result.append(OAuth2Claim(self.form_response_body(item))) except Exception as error: return (None, response, error) return (result, response, None)
async def update_o_auth_2_claim(self, authServerId, claimId, o_auth_2_claim): """ Args: auth_server_id {str} claim_id {str} {o_auth_2_claim} Returns: OAuth2Claim """ http_method = "put".upper() api_url = format_url(f""" {self._base_url} /api/v1/authorizationServers/{authServerId}/claims /{claimId} """) if isinstance(o_auth_2_claim, dict): body = o_auth_2_claim else: body = o_auth_2_claim.as_dict() headers = { "Accept": "application/json", "Content-Type": "application/json" } request, error = await self._request_executor.create_request( http_method, api_url, body, headers) if error: return (None, None, error) response, error = await self._request_executor\ .execute(request, OAuth2Claim) if error: return (None, response, error) try: result = OAuth2Claim(self.form_response_body(response.get_body())) except Exception as error: return (None, response, error) return (result, response, None)