Class AwsEndpointProviderUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic EndpointaddHostPrefix(Endpoint endpoint, String prefix) Apply the given endpoint prefix to the endpoint.static booleanTrue if theSdkInternalExecutionAttribute.DISABLE_HOST_PREFIX_INJECTIONattribute is present and its value istrue,falseotherwise.static BooleandualStackEnabledBuiltIn(ExecutionAttributes executionAttributes) static StringendpointBuiltIn(ExecutionAttributes executionAttributes) Returns the endpoint set on the client.static booleanDeprecated.static booleanTrue if theSdkInternalExecutionAttribute.CLIENT_ENDPOINT_PROVIDER's endpoint is overridden.static BooleanfipsEnabledBuiltIn(ExecutionAttributes executionAttributes) static RegionregionBuiltIn(ExecutionAttributes executionAttributes) static SdkHttpRequestsetUri(SdkHttpRequest request, URI clientEndpoint, URI resolvedUri) Deprecated.UsesetUri(SdkHttpRequest, URI, EndpointUrl)instead for better performance by avoiding intermediate URI construction.static SdkHttpRequestsetUri(SdkHttpRequest request, URI clientEndpoint, EndpointUrl resolvedUrl) Sets the request URI to the resolved endpoint URL returned by the endpoint provider, reading URL components directly from theEndpointUrlwithout constructing an intermediateURI.static booleanTrue if endpoint resolution should be skipped for the current request.
-
Method Details
-
regionBuiltIn
-
dualStackEnabledBuiltIn
-
fipsEnabledBuiltIn
-
endpointBuiltIn
Returns the endpoint set on the client. Note that this strips off the query part of the URI because the endpoint rules library, e.g.ParseURLwill return an exception if the URI it parses has query parameters. -
endpointIsOverridden
True if theSdkInternalExecutionAttribute.CLIENT_ENDPOINT_PROVIDER's endpoint is overridden. -
endpointIsDiscovered
Deprecated.UseskipEndpointResolution(ExecutionAttributes)instead.True if theSdkInternalExecutionAttribute.IS_DISCOVERED_ENDPOINTattribute is present and its value istrue,falseotherwise. -
skipEndpointResolution
True if endpoint resolution should be skipped for the current request. This returnstrueif eitherSdkInternalExecutionAttribute.SKIP_ENDPOINT_RESOLUTIONorSdkInternalExecutionAttribute.IS_DISCOVERED_ENDPOINTis set totrue. -
disableHostPrefixInjection
True if theSdkInternalExecutionAttribute.DISABLE_HOST_PREFIX_INJECTIONattribute is present and its value istrue,falseotherwise. -
addHostPrefix
-
setUri
@Deprecated public static SdkHttpRequest setUri(SdkHttpRequest request, URI clientEndpoint, URI resolvedUri) Deprecated.UsesetUri(SdkHttpRequest, URI, EndpointUrl)instead for better performance by avoiding intermediate URI construction.This sets the request URI to the resolved URI returned by the endpoint provider. There are some things to be careful about to make this work properly:If the client endpoint is an endpoint override, it may contain a path. In addition, the request marshaller itself may add components to the path if it's modeled for the operation. Unfortunately,
SdkHttpRequest.encodedPath()returns the combined path from both the endpoint and the request. There is no way to know, just from the HTTP request object, where the override path ends (if it's even there) and where the request path starts. Additionally, the rule itself may also append other parts to the endpoint override path.To solve this issue, we pass in the endpoint set on the client, which allows us to the strip the path from the endpoint override from the request path, and then correctly combine the paths.
For example, let's suppose the endpoint override on the client is
https://example.com/a. Then we call an operationFoo(), that marshalls/cto the path. The resulting request path is/a/c. However, we also pass the endpoint to provider as a parameter, and the resolver returnshttps://example.com/a/b. This method takes care of combining the paths correctly so that the resulting path ishttps://example.com/a/b/c. -
setUri
public static SdkHttpRequest setUri(SdkHttpRequest request, URI clientEndpoint, EndpointUrl resolvedUrl) Sets the request URI to the resolved endpoint URL returned by the endpoint provider, reading URL components directly from theEndpointUrlwithout constructing an intermediateURI.This overload has the same behavior as
setUri(SdkHttpRequest, URI, URI)but avoids the cost ofURIconstruction, making it suitable for presigners and other code paths that resolve endpoints outside the main pipeline.- Parameters:
request- the current HTTP requestclientEndpoint- the endpoint configured on the client (may include a path prefix from endpoint override)resolvedUrl- the resolved endpoint URL from the rules engine- Returns:
- a new
SdkHttpRequestwith scheme, host, port, and path applied from the resolved URL
-
skipEndpointResolution(ExecutionAttributes)instead.