/
CodeCommitConfiguration.ts
408 lines (355 loc) · 12.1 KB
/
CodeCommitConfiguration.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
import * as __aws_sdk_core_handler from "@aws-sdk/core-handler";
import * as __aws_sdk_credential_provider_node from "@aws-sdk/credential-provider-node";
import * as __aws_sdk_hash_node from "@aws-sdk/hash-node";
import * as __aws_sdk_json_builder from "@aws-sdk/json-builder";
import * as __aws_sdk_json_error_unmarshaller from "@aws-sdk/json-error-unmarshaller";
import * as __aws_sdk_json_parser from "@aws-sdk/json-parser";
import * as __aws_sdk_middleware_serializer from "@aws-sdk/middleware-serializer";
import * as __aws_sdk_node_http_handler from "@aws-sdk/node-http-handler";
import * as __aws_sdk_protocol_json_rpc from "@aws-sdk/protocol-json-rpc";
import * as __aws_sdk_region_provider from "@aws-sdk/region-provider";
import * as __aws_sdk_signature_v4 from "@aws-sdk/signature-v4";
import * as __aws_sdk_signing_middleware from "@aws-sdk/signing-middleware";
import * as __aws_sdk_stream_collector_node from "@aws-sdk/stream-collector-node";
import * as __aws_sdk_types from "@aws-sdk/types";
import * as __aws_sdk_url_parser_node from "@aws-sdk/url-parser-node";
import * as __aws_sdk_util_base64_node from "@aws-sdk/util-base64-node";
import * as __aws_sdk_util_body_length_node from "@aws-sdk/util-body-length-node";
import * as __aws_sdk_util_utf8_node from "@aws-sdk/util-utf8-node";
import * as _stream from "stream";
import { OutputTypesUnion } from "./types/OutputTypesUnion";
export interface CodeCommitConfiguration {
/**
* The function that will be used to convert a base64-encoded string to a byte array
*/
base64Decoder?: __aws_sdk_types.Decoder;
/**
* The function that will be used to convert binary data to a base64-encoded string
*/
base64Encoder?: __aws_sdk_types.Encoder;
/**
* The credentials used to sign requests.
*
* If no static credentials are supplied, the SDK will attempt to credentials from known environment variables, from shared configuration and credentials files, and from the EC2 Instance Metadata Service, in that order.
*/
credentials?:
| __aws_sdk_types.Credentials
| __aws_sdk_types.Provider<__aws_sdk_types.Credentials>;
/**
* A function that determines how long (in milliseconds) the SDK should wait before retrying a request
*/
delayDecider?: __aws_sdk_types.DelayDecider;
/**
* The fully qualified endpoint of the webservice. This is only required when using a custom endpoint (for example, when using a local version of S3).
*/
endpoint?:
| string
| __aws_sdk_types.HttpEndpoint
| __aws_sdk_types.Provider<__aws_sdk_types.HttpEndpoint>;
/**
* The endpoint provider to call if no endpoint is provided
*/
endpointProvider?: any;
/**
* The handler to use as the core of the client's middleware stack
*/
handler?: __aws_sdk_types.Terminalware<any, _stream.Readable>;
/**
* The HTTP handler to use
*/
httpHandler?: __aws_sdk_types.HttpHandler<_stream.Readable>;
/**
* Whether sockets should be kept open even when there are no outstanding requests so that future requests can forgo having to reestablish a TCP or TLS connection. Defaults to true.
*/
keepAlive?: boolean;
/**
* The maximum number of redirects to follow for a service request. Set to `0` to disable retries.
*/
maxRedirects?: number;
/**
* The maximum number of times requests that encounter potentially transient failures should be retried
*/
maxRetries?: number;
/**
* The configuration profile to use.
*/
profile?: string;
/**
* The AWS region to which this client will send requests
*/
region?: string | __aws_sdk_types.Provider<string>;
/**
* A function that determines whether an error is retryable
*/
retryDecider?: __aws_sdk_types.RetryDecider;
/**
* A constructor for a class implementing the @aws-sdk/types.Hash interface that computes the SHA-256 HMAC or checksum of a string or binary buffer
*/
sha256?: __aws_sdk_types.HashConstructor;
/**
* The signer to use when signing requests.
*/
signer?: __aws_sdk_types.RequestSigner;
/**
* The service name with which to sign requests.
*/
signingName?: string;
/**
* Whether SSL is enabled for requests.
*/
sslEnabled?: boolean;
/**
* A function that converts a stream into an array of bytes.
*/
streamCollector?: __aws_sdk_types.StreamCollector<_stream.Readable>;
/**
* The function that will be used to convert strings into HTTP endpoints
*/
urlParser?: __aws_sdk_types.UrlParser;
/**
* The function that will be used to convert a UTF8-encoded string to a byte array
*/
utf8Decoder?: __aws_sdk_types.Decoder;
/**
* The function that will be used to convert binary data to a UTF-8 encoded string
*/
utf8Encoder?: __aws_sdk_types.Encoder;
}
export interface CodeCommitResolvableConfiguration
extends CodeCommitConfiguration {
/**
* Whether the HTTP handler was injected by the user and should thus not be destroyed when this client is
*/
_user_injected_http_handler: any;
/**
* A function that can calculate the length of a request body.
*/
bodyLengthChecker: (body: any) => number | undefined;
/**
* The parser to use when converting HTTP responses to SDK output types
*/
parser: __aws_sdk_types.ResponseParser<_stream.Readable>;
/**
* The serializer to use when converting SDK input to HTTP requests
*/
serializer: __aws_sdk_types.Provider<
__aws_sdk_types.RequestSerializer<_stream.Readable>
>;
}
export interface CodeCommitResolvedConfiguration
extends CodeCommitConfiguration,
__aws_sdk_types.ClientResolvedConfigurationBase<
OutputTypesUnion,
_stream.Readable
> {
_user_injected_http_handler: boolean;
base64Decoder: __aws_sdk_types.Decoder;
base64Encoder: __aws_sdk_types.Encoder;
bodyLengthChecker: (body: any) => number | undefined;
credentials: __aws_sdk_types.Provider<__aws_sdk_types.Credentials>;
endpoint: __aws_sdk_types.Provider<__aws_sdk_types.HttpEndpoint>;
endpointProvider: any;
handler: __aws_sdk_types.Terminalware<any, _stream.Readable>;
httpHandler: __aws_sdk_types.HttpHandler<_stream.Readable>;
keepAlive: boolean;
maxRedirects: number;
maxRetries: number;
parser: __aws_sdk_types.ResponseParser<_stream.Readable>;
region: __aws_sdk_types.Provider<string>;
serializer: __aws_sdk_types.Provider<
__aws_sdk_types.RequestSerializer<_stream.Readable>
>;
sha256: __aws_sdk_types.HashConstructor;
signer: __aws_sdk_types.RequestSigner;
signingName: string;
sslEnabled: boolean;
streamCollector: __aws_sdk_types.StreamCollector<_stream.Readable>;
urlParser: __aws_sdk_types.UrlParser;
utf8Decoder: __aws_sdk_types.Decoder;
utf8Encoder: __aws_sdk_types.Encoder;
}
export const configurationProperties: __aws_sdk_types.ConfigurationDefinition<
CodeCommitResolvableConfiguration,
CodeCommitResolvedConfiguration
> = {
profile: {},
maxRedirects: {
defaultValue: 10
},
maxRetries: {
defaultValue: 3
},
region: {
defaultProvider: __aws_sdk_region_provider.defaultProvider,
normalize: (
value: string | __aws_sdk_types.Provider<string> | undefined
) => {
if (typeof value === "string") {
const promisified = Promise.resolve(value);
return () => promisified;
}
return value!;
}
},
sslEnabled: {
defaultValue: true
},
urlParser: {
defaultValue: __aws_sdk_url_parser_node.parseUrl
},
endpointProvider: {
defaultValue: (sslEnabled: boolean, region: string) => ({
protocol: sslEnabled ? "https:" : "http:",
path: "/",
hostname: `codecommit.${region}.amazonaws.com`
})
},
endpoint: {
defaultProvider: (configuration: {
sslEnabled: boolean;
endpointProvider: any;
region: __aws_sdk_types.Provider<string>;
}) => {
const promisified = configuration
.region()
.then(region =>
configuration.endpointProvider(configuration.sslEnabled, region)
);
return () => promisified;
},
normalize: (
value:
| string
| __aws_sdk_types.HttpEndpoint
| __aws_sdk_types.Provider<__aws_sdk_types.HttpEndpoint>
| undefined,
configuration: {
urlParser?: __aws_sdk_types.UrlParser;
}
): __aws_sdk_types.Provider<__aws_sdk_types.HttpEndpoint> => {
if (typeof value === "string") {
const promisified = Promise.resolve(configuration.urlParser!(value));
return () => promisified;
} else if (typeof value === "object") {
const promisified = Promise.resolve(value);
return () => promisified;
}
// Users are not required to supply an endpoint, so `value`
// could be undefined. This function, however, will only be
// invoked if `value` is defined, so the return will never
// be undefined.
return value!;
}
},
base64Decoder: {
defaultValue: __aws_sdk_util_base64_node.fromBase64
},
base64Encoder: {
defaultValue: __aws_sdk_util_base64_node.toBase64
},
utf8Decoder: {
defaultValue: __aws_sdk_util_utf8_node.fromUtf8
},
utf8Encoder: {
defaultValue: __aws_sdk_util_utf8_node.toUtf8
},
streamCollector: {
defaultValue: __aws_sdk_stream_collector_node.streamCollector
},
serializer: {
defaultProvider: (configuration: {
base64Encoder: __aws_sdk_types.Encoder;
endpoint: __aws_sdk_types.Provider<__aws_sdk_types.HttpEndpoint>;
utf8Decoder: __aws_sdk_types.Decoder;
}) => {
const promisified = configuration
.endpoint()
.then(
endpoint =>
new __aws_sdk_protocol_json_rpc.JsonRpcSerializer<_stream.Readable>(
endpoint,
new __aws_sdk_json_builder.JsonBuilder(
configuration.base64Encoder,
configuration.utf8Decoder
)
)
);
return () => promisified;
}
},
parser: {
defaultProvider: (configuration: {
base64Decoder: __aws_sdk_types.Decoder;
streamCollector: __aws_sdk_types.StreamCollector<_stream.Readable>;
utf8Encoder: __aws_sdk_types.Encoder;
}) =>
new __aws_sdk_protocol_json_rpc.JsonRpcParser(
new __aws_sdk_json_parser.JsonParser(configuration.base64Decoder),
__aws_sdk_json_error_unmarshaller.jsonErrorUnmarshaller,
configuration.streamCollector,
configuration.utf8Encoder
)
},
keepAlive: {
defaultValue: true
},
_user_injected_http_handler: {
defaultProvider: (configuration: { httpHandler?: any }) =>
!configuration.httpHandler
},
httpHandler: {
defaultProvider: (configuration: { keepAlive: boolean }) =>
new __aws_sdk_node_http_handler.NodeHttpHandler(configuration)
},
handler: {
defaultProvider: (configuration: {
httpHandler: __aws_sdk_types.HttpHandler<_stream.Readable>;
parser: __aws_sdk_types.ResponseParser<_stream.Readable>;
}) =>
__aws_sdk_core_handler.coreHandler<OutputTypesUnion, _stream.Readable>(
configuration.httpHandler,
configuration.parser
)
},
bodyLengthChecker: {
defaultValue: __aws_sdk_util_body_length_node.calculateBodyLength
},
retryDecider: {},
delayDecider: {},
credentials: {
defaultProvider: __aws_sdk_credential_provider_node.defaultProvider,
normalize: (
value:
| __aws_sdk_types.Credentials
| __aws_sdk_types.Provider<__aws_sdk_types.Credentials>
| undefined
) => {
if (typeof value === "object") {
const promisified = Promise.resolve(value);
return () => promisified;
}
return value!;
}
},
sha256: {
defaultValue: __aws_sdk_hash_node.Hash.bind(null, "sha256")
},
signingName: {
defaultValue: "codecommit"
},
signer: {
defaultProvider: (configuration: {
credentials: __aws_sdk_types.Provider<__aws_sdk_types.Credentials>;
region: __aws_sdk_types.Provider<string>;
sha256: __aws_sdk_types.HashConstructor;
signingName: string;
}) =>
new __aws_sdk_signature_v4.SignatureV4({
credentials: configuration.credentials,
region: configuration.region,
service: configuration.signingName,
sha256: configuration.sha256,
uriEscapePath: true
})
}
};