1 /* 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"). 5 * You may not use this file except in compliance with the License. 6 * A copy of the License is located at 7 * 8 * http://aws.amazon.com/apache2.0 9 * 10 * or in the "license" file accompanying this file. This file is distributed 11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 * express or implied. See the License for the specific language governing 13 * permissions and limitations under the License. 14 */ 15 16 package software.amazon.awssdk.core.interceptor; 17 18 import java.util.Map; 19 import java.util.concurrent.atomic.AtomicLong; 20 import software.amazon.awssdk.annotations.SdkProtectedApi; 21 import software.amazon.awssdk.core.SdkClient; 22 import software.amazon.awssdk.core.SdkProtocolMetadata; 23 import software.amazon.awssdk.core.SelectedAuthScheme; 24 import software.amazon.awssdk.core.checksums.ChecksumSpecs; 25 import software.amazon.awssdk.core.interceptor.trait.HttpChecksum; 26 import software.amazon.awssdk.core.interceptor.trait.HttpChecksumRequired; 27 import software.amazon.awssdk.core.internal.interceptor.trait.RequestCompression; 28 import software.amazon.awssdk.endpoints.Endpoint; 29 import software.amazon.awssdk.endpoints.EndpointProvider; 30 import software.amazon.awssdk.http.SdkHttpExecutionAttributes; 31 import software.amazon.awssdk.http.auth.spi.scheme.AuthScheme; 32 import software.amazon.awssdk.http.auth.spi.scheme.AuthSchemeProvider; 33 import software.amazon.awssdk.identity.spi.IdentityProviders; 34 import software.amazon.awssdk.utils.AttributeMap; 35 36 /** 37 * Attributes that can be applied to all sdk requests. Only generated code from the SDK clients should set these values. 38 */ 39 @SdkProtectedApi 40 public final class SdkInternalExecutionAttribute extends SdkExecutionAttribute { 41 42 /** 43 * The key to indicate if the request is for a full duplex operation ie., request and response are sent/received 44 * at the same time. 45 */ 46 public static final ExecutionAttribute<Boolean> IS_FULL_DUPLEX = new ExecutionAttribute<>("IsFullDuplex"); 47 48 /** 49 * If true, indicates that this is an event streaming request being sent over RPC, and therefore the serialized 50 * request object is encapsulated as an event of type {@code initial-request}. 51 */ 52 public static final ExecutionAttribute<Boolean> HAS_INITIAL_REQUEST_EVENT = new ExecutionAttribute<>( 53 "HasInitialRequestEvent"); 54 55 public static final ExecutionAttribute<HttpChecksumRequired> HTTP_CHECKSUM_REQUIRED = 56 new ExecutionAttribute<>("HttpChecksumRequired"); 57 58 /** 59 * Whether host prefix injection has been disabled on the client. 60 * See {@link software.amazon.awssdk.core.client.config.SdkAdvancedClientOption#DISABLE_HOST_PREFIX_INJECTION} 61 */ 62 public static final ExecutionAttribute<Boolean> DISABLE_HOST_PREFIX_INJECTION = 63 new ExecutionAttribute<>("DisableHostPrefixInjection"); 64 65 /** 66 * Key to indicate if the Http Checksums that are valid for an operation. 67 */ 68 public static final ExecutionAttribute<HttpChecksum> HTTP_CHECKSUM = 69 new ExecutionAttribute<>("HttpChecksum"); 70 71 /** 72 * The SDK HTTP attributes that can be passed to the HTTP client 73 */ 74 public static final ExecutionAttribute<SdkHttpExecutionAttributes> SDK_HTTP_EXECUTION_ATTRIBUTES = 75 new ExecutionAttribute<>("SdkHttpExecutionAttributes"); 76 77 public static final ExecutionAttribute<Boolean> IS_NONE_AUTH_TYPE_REQUEST = 78 new ExecutionAttribute<>("IsNoneAuthTypeRequest"); 79 80 /** 81 * The endpoint provider used to resolve the destination endpoint for a request. 82 */ 83 public static final ExecutionAttribute<EndpointProvider> ENDPOINT_PROVIDER = 84 new ExecutionAttribute<>("EndpointProvider"); 85 86 /** 87 * The resolved endpoint as computed by the client's configured {@link EndpointProvider}. 88 */ 89 public static final ExecutionAttribute<Endpoint> RESOLVED_ENDPOINT = 90 new ExecutionAttribute<>("ResolvedEndpoint"); 91 92 /** 93 * The values of client context params declared for this service. Client contet params are one possible source of inputs into 94 * the endpoint provider for the client. 95 */ 96 public static final ExecutionAttribute<AttributeMap> CLIENT_CONTEXT_PARAMS = 97 new ExecutionAttribute<>("ClientContextParams"); 98 99 /** 100 * Whether the endpoint on the request is the result of Endpoint Discovery. 101 */ 102 public static final ExecutionAttribute<Boolean> IS_DISCOVERED_ENDPOINT = 103 new ExecutionAttribute<>("IsDiscoveredEndpoint"); 104 105 /** 106 * The nano time that the current API call attempt began. 107 */ 108 public static final ExecutionAttribute<Long> API_CALL_ATTEMPT_START_NANO_TIME = 109 new ExecutionAttribute<>("ApiCallAttemptStartNanoTime"); 110 111 /** 112 * The nano time that reading the response headers is complete. 113 */ 114 public static final ExecutionAttribute<Long> HEADERS_READ_END_NANO_TIME = 115 new ExecutionAttribute<>("HeadersReadEndNanoTime"); 116 117 /** 118 * The running count of bytes in the response body that have been read by the client. This is updated atomically as the 119 * response is being read. 120 * <p> 121 * This attribute is set before every API call attempt. 122 */ 123 public static final ExecutionAttribute<AtomicLong> RESPONSE_BYTES_READ = 124 new ExecutionAttribute<>("ResponseBytesRead"); 125 126 /** 127 * The auth scheme provider used to resolve the auth scheme for a request. 128 */ 129 public static final ExecutionAttribute<AuthSchemeProvider> AUTH_SCHEME_RESOLVER = 130 new ExecutionAttribute<>("AuthSchemeProvider"); 131 132 /** 133 * The auth schemes available for a request. 134 */ 135 public static final ExecutionAttribute<Map<String, AuthScheme<?>>> AUTH_SCHEMES = new ExecutionAttribute<>("AuthSchemes"); 136 137 /** 138 * The {@link IdentityProviders} for a request. 139 */ 140 public static final ExecutionAttribute<IdentityProviders> IDENTITY_PROVIDERS = new ExecutionAttribute<>("IdentityProviders"); 141 142 /** 143 * The selected auth scheme for a request. 144 */ 145 public static final ExecutionAttribute<SelectedAuthScheme<?>> SELECTED_AUTH_SCHEME = 146 new ExecutionAttribute<>("SelectedAuthScheme"); 147 148 /** 149 * The supported compression algorithms for an operation, and whether the operation is streaming or not. 150 */ 151 public static final ExecutionAttribute<RequestCompression> REQUEST_COMPRESSION = 152 new ExecutionAttribute<>("RequestCompression"); 153 154 /** 155 * The key under which the protocol metadata is stored. 156 */ 157 public static final ExecutionAttribute<SdkProtocolMetadata> PROTOCOL_METADATA = 158 new ExecutionAttribute<>("ProtocolMetadata"); 159 160 public static final ExecutionAttribute<SdkClient> SDK_CLIENT = 161 new ExecutionAttribute<>("SdkClient"); 162 163 /** 164 * The backing attribute for RESOLVED_CHECKSUM_SPECS. 165 * This holds the real ChecksumSpecs value, and is used to map to the ChecksumAlgorithm signer property 166 * in the SELECTED_AUTH_SCHEME execution attribute. 167 */ 168 static final ExecutionAttribute<ChecksumSpecs> INTERNAL_RESOLVED_CHECKSUM_SPECS = 169 new ExecutionAttribute<>("InternalResolvedChecksumSpecs"); 170 SdkInternalExecutionAttribute()171 private SdkInternalExecutionAttribute() { 172 } 173 } 174