MCPcopy Create free account
hub / github.com/aws/aws-cli / _resolve_endpoint_ruleset

Method _resolve_endpoint_ruleset

awscli/botocore/client.py:1003–1053  ·  view source on GitHub ↗

Returns endpoint URL and list of additional headers returned from EndpointRulesetResolver for the given operation and params. If the ruleset resolver is not available, for example because the service has no endpoints ruleset file, the legacy endpoint resolver's value is

(
        self,
        operation_model,
        params,
        request_context,
        ignore_signing_region=False,
    )

Source from the content-addressed store, hash-verified

1001 return api_params
1002
1003 def _resolve_endpoint_ruleset(
1004 self,
1005 operation_model,
1006 params,
1007 request_context,
1008 ignore_signing_region=False,
1009 ):
1010 """Returns endpoint URL and list of additional headers returned from
1011 EndpointRulesetResolver for the given operation and params. If the
1012 ruleset resolver is not available, for example because the service has
1013 no endpoints ruleset file, the legacy endpoint resolver's value is
1014 returned.
1015
1016 Use ignore_signing_region for generating presigned URLs or any other
1017 situtation where the signing region information from the ruleset
1018 resolver should be ignored.
1019
1020 Returns tuple of URL and headers dictionary. Additionally, the
1021 request_context dict is modified in place with any signing information
1022 returned from the ruleset resolver.
1023 """
1024 if self._ruleset_resolver is None:
1025 endpoint_url = self.meta.endpoint_url
1026 additional_headers = {}
1027 endpoint_properties = {}
1028 else:
1029 endpoint_info = self._ruleset_resolver.construct_endpoint(
1030 operation_model=operation_model,
1031 call_args=params,
1032 request_context=request_context,
1033 )
1034 endpoint_url = endpoint_info.url
1035 additional_headers = endpoint_info.headers
1036 endpoint_properties = endpoint_info.properties
1037 # If authSchemes is present, overwrite default auth type and
1038 # signing context derived from service model.
1039 auth_schemes = endpoint_info.properties.get('authSchemes')
1040 if auth_schemes is not None:
1041 auth_info = self._ruleset_resolver.auth_schemes_to_signing_ctx(
1042 auth_schemes
1043 )
1044 auth_type, signing_context = auth_info
1045 request_context['auth_type'] = auth_type
1046 if 'region' in signing_context and ignore_signing_region:
1047 del signing_context['region']
1048 if 'signing' in request_context:
1049 request_context['signing'].update(signing_context)
1050 else:
1051 request_context['signing'] = signing_context
1052
1053 return endpoint_url, additional_headers, endpoint_properties
1054
1055 def get_paginator(self, operation_name):
1056 """Create a paginator for an operation.

Callers 3

_make_api_callMethod · 0.95
generate_presigned_urlFunction · 0.80
generate_presigned_postFunction · 0.80

Calls 3

construct_endpointMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected