public final class AwsEndpointProviderUtils extends Object
Modifier and Type | Method and Description |
---|---|
static AwsRequest |
addHeaders(AwsRequest request,
Map<String,List<String>> headers) |
static Endpoint |
addHostPrefix(Endpoint endpoint,
String prefix)
Apply the given endpoint prefix to the endpoint.
|
static boolean |
disableHostPrefixInjection(ExecutionAttributes attrs)
True if the the
SdkInternalExecutionAttribute.DISABLE_HOST_PREFIX_INJECTION attribute is present and its
value is true , false otherwise. |
static Boolean |
dualStackEnabledBuiltIn(ExecutionAttributes executionAttributes) |
static String |
endpointBuiltIn(ExecutionAttributes executionAttributes)
Returns the endpoint set on the client.
|
static boolean |
endpointIsDiscovered(ExecutionAttributes attrs)
True if the the
SdkInternalExecutionAttribute.IS_DISCOVERED_ENDPOINT attribute is present and its value
is true , false otherwise. |
static boolean |
endpointIsOverridden(ExecutionAttributes attrs)
True if the the
SdkExecutionAttribute.ENDPOINT_OVERRIDDEN attribute is present and its value is
true , false otherwise. |
static Boolean |
fipsEnabledBuiltIn(ExecutionAttributes executionAttributes) |
static Region |
regionBuiltIn(ExecutionAttributes executionAttributes) |
static SdkHttpRequest |
setUri(SdkHttpRequest request,
URI clientEndpoint,
URI resolvedUri)
This sets the request URI to the resolved URI returned by the endpoint provider.
|
static Boolean |
useGlobalEndpointBuiltIn(ExecutionAttributes executionAttributes) |
static Endpoint |
valueAsEndpointOrThrow(Value value) |
public static Region regionBuiltIn(ExecutionAttributes executionAttributes)
public static Boolean dualStackEnabledBuiltIn(ExecutionAttributes executionAttributes)
public static Boolean fipsEnabledBuiltIn(ExecutionAttributes executionAttributes)
public static String endpointBuiltIn(ExecutionAttributes executionAttributes)
ParseURL
will return an exception if the URI it parses has query parameters.public static Boolean useGlobalEndpointBuiltIn(ExecutionAttributes executionAttributes)
public static boolean endpointIsOverridden(ExecutionAttributes attrs)
SdkExecutionAttribute.ENDPOINT_OVERRIDDEN
attribute is present and its value is
true
, false
otherwise.public static boolean endpointIsDiscovered(ExecutionAttributes attrs)
SdkInternalExecutionAttribute.IS_DISCOVERED_ENDPOINT
attribute is present and its value
is true
, false
otherwise.public static boolean disableHostPrefixInjection(ExecutionAttributes attrs)
SdkInternalExecutionAttribute.DISABLE_HOST_PREFIX_INJECTION
attribute is present and its
value is true
, false
otherwise.public static Endpoint addHostPrefix(Endpoint endpoint, String prefix)
public static SdkHttpRequest setUri(SdkHttpRequest request, URI clientEndpoint, URI resolvedUri)
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 path, 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
operation Foo()
, that marshalls /c
to the path. The resulting request path is /a/c
.
However, we also pass the endpoint to provider as a parameter, and the resolver returns
https://example.com/a/b
. This method takes care of combining the paths correctly so that the resulting
path is https://example.com/a/b/c
.
public static AwsRequest addHeaders(AwsRequest request, Map<String,List<String>> headers)
Copyright © 2023. All rights reserved.