1 | import { Endpoint } from "./http";
|
2 | import { FinalizeHandler, FinalizeHandlerArguments, FinalizeHandlerOutput } from "./middleware";
|
3 | import { MetadataBearer } from "./response";
|
4 | /**
|
5 | * @public
|
6 | *
|
7 | * A function that, given a TypedArray of bytes, can produce a string
|
8 | * representation thereof.
|
9 | *
|
10 | * @example An encoder function that converts bytes to hexadecimal
|
11 | * representation would return `'deadbeef'` when given
|
12 | * `new Uint8Array([0xde, 0xad, 0xbe, 0xef])`.
|
13 | */
|
14 | export interface Encoder {
|
15 | (input: Uint8Array): string;
|
16 | }
|
17 | /**
|
18 | * @public
|
19 | *
|
20 | * A function that, given a string, can derive the bytes represented by that
|
21 | * string.
|
22 | *
|
23 | * @example A decoder function that converts bytes to hexadecimal
|
24 | * representation would return `new Uint8Array([0xde, 0xad, 0xbe, 0xef])` when
|
25 | * given the string `'deadbeef'`.
|
26 | */
|
27 | export interface Decoder {
|
28 | (input: string): Uint8Array;
|
29 | }
|
30 | /**
|
31 | * @public
|
32 | *
|
33 | * A function that, when invoked, returns a promise that will be fulfilled with
|
34 | * a value of type T.
|
35 | *
|
36 | * @example A function that reads credentials from shared SDK configuration
|
37 | * files, assuming roles and collecting MFA tokens as necessary.
|
38 | */
|
39 | export interface Provider<T> {
|
40 | (): Promise<T>;
|
41 | }
|
42 | /**
|
43 | * @public
|
44 | *
|
45 | * A function that, when invoked, returns a promise that will be fulfilled with
|
46 | * a value of type T. It memoizes the result from the previous invocation
|
47 | * instead of calling the underlying resources every time.
|
48 | *
|
49 | * You can force the provider to refresh the memoized value by invoke the
|
50 | * function with optional parameter hash with `forceRefresh` boolean key and
|
51 | * value `true`.
|
52 | *
|
53 | * @example A function that reads credentials from IMDS service that could
|
54 | * return expired credentials. The SDK will keep using the expired credentials
|
55 | * until an unretryable service error requiring a force refresh of the
|
56 | * credentials.
|
57 | */
|
58 | export interface MemoizedProvider<T> {
|
59 | (options?: {
|
60 | forceRefresh?: boolean;
|
61 | }): Promise<T>;
|
62 | }
|
63 | /**
|
64 | * @public
|
65 | *
|
66 | * A function that, given a request body, determines the
|
67 | * length of the body. This is used to determine the Content-Length
|
68 | * that should be sent with a request.
|
69 | *
|
70 | * @example A function that reads a file stream and calculates
|
71 | * the size of the file.
|
72 | */
|
73 | export interface BodyLengthCalculator {
|
74 | (body: any): number | undefined;
|
75 | }
|
76 | /**
|
77 | * @public
|
78 | *
|
79 | * Interface that specifies the retry behavior
|
80 | */
|
81 | export interface RetryStrategy {
|
82 | /**
|
83 | * The retry mode describing how the retry strategy control the traffic flow.
|
84 | */
|
85 | mode?: string;
|
86 | /**
|
87 | * the retry behavior the will invoke the next handler and handle the retry accordingly.
|
88 | * This function should also update the $metadata from the response accordingly.
|
89 | * @see {@link ResponseMetadata}
|
90 | */
|
91 | retry: <Input extends object, Output extends MetadataBearer>(next: FinalizeHandler<Input, Output>, args: FinalizeHandlerArguments<Input>) => Promise<FinalizeHandlerOutput<Output>>;
|
92 | }
|
93 | /**
|
94 | * @public
|
95 | *
|
96 | * Parses a URL in string form into an Endpoint object.
|
97 | */
|
98 | export interface UrlParser {
|
99 | (url: string | URL): Endpoint;
|
100 | }
|
101 | /**
|
102 | * @public
|
103 | *
|
104 | * Object containing regionalization information of
|
105 | * AWS services.
|
106 | */
|
107 | export interface RegionInfo {
|
108 | hostname: string;
|
109 | partition: string;
|
110 | path?: string;
|
111 | signingService?: string;
|
112 | signingRegion?: string;
|
113 | }
|
114 | /**
|
115 | * @public
|
116 | *
|
117 | * Options to pass when calling {@link RegionInfoProvider}
|
118 | */
|
119 | export interface RegionInfoProviderOptions {
|
120 | /**
|
121 | * Enables IPv6/IPv4 dualstack endpoint.
|
122 | * @defaultValue false
|
123 | */
|
124 | useDualstackEndpoint: boolean;
|
125 | /**
|
126 | * Enables FIPS compatible endpoints.
|
127 | * @defaultValue false
|
128 | */
|
129 | useFipsEndpoint: boolean;
|
130 | }
|
131 | /**
|
132 | * @public
|
133 | *
|
134 | * Function returns designated service's regionalization
|
135 | * information from given region. Each service client
|
136 | * comes with its regionalization provider. it serves
|
137 | * to provide the default values of related configurations
|
138 | */
|
139 | export interface RegionInfoProvider {
|
140 | (region: string, options?: RegionInfoProviderOptions): Promise<RegionInfo | undefined>;
|
141 | }
|
142 | /**
|
143 | * @public
|
144 | *
|
145 | * A tuple that represents an API name and optional version
|
146 | * of a library built using the AWS SDK.
|
147 | */
|
148 | export type UserAgentPair = [name: string, version?: string];
|
149 | /**
|
150 | * @public
|
151 | *
|
152 | * User agent data that to be put into the request's user
|
153 | * agent.
|
154 | */
|
155 | export type UserAgent = UserAgentPair[];
|