|
1 |
| -import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node"; |
2 |
| -import { Hash } from "@aws-sdk/hash-node"; |
3 |
| -import { NodeHttpHandler } from "@aws-sdk/node-http-handler"; |
4 |
| -import { defaultProvider as regionDefaultProvider } from "@aws-sdk/region-provider"; |
5 |
| -import { parseUrl } from "@aws-sdk/url-parser-node"; |
6 |
| -import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; |
7 |
| -import { streamCollector } from "@aws-sdk/stream-collector-node"; |
8 |
| -import { RestJsonProtocol } from "@aws-sdk/protocol-rest-json"; |
9 |
| -import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; |
10 |
| -import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; |
11 |
| -import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; |
12 | 1 | import { AwsAuth, AwsAuthInput } from "@aws-sdk/middleware-signing";
|
13 | 2 | import { UserAgent, UserAgentInput } from "@aws-sdk/middleware-user-agent";
|
14 | 3 | import { Retry, RetryInput } from "@aws-sdk/middleware-retry";
|
15 |
| -import { name, version } from "./package.json"; |
16 | 4 | import {
|
17 | 5 | Region,
|
18 | 6 | RegionInput,
|
19 | 7 | Endpoints,
|
20 | 8 | EndpointsInput,
|
21 | 9 | ClientProtocol,
|
22 |
| - ClientProtocolInput, |
23 |
| - AWSClientRuntimeConfiguration |
| 10 | + ClientProtocolInput |
24 | 11 | } from "@aws-sdk/config-resolver";
|
| 12 | +import { |
| 13 | + Credentials, |
| 14 | + Provider, |
| 15 | + HashConstructor, |
| 16 | + UrlParser, |
| 17 | + Protocol, |
| 18 | + StreamCollector, |
| 19 | + Decoder, |
| 20 | + Encoder |
| 21 | +} from "@aws-sdk/types"; |
| 22 | +import { HttpHandler, HttpRequest, HttpResponse } from "@aws-sdk/protocol-http"; |
| 23 | + |
| 24 | +export interface RDSDataRuntimeDependencies { |
| 25 | + /** |
| 26 | + * The HTTP handler to use. Fetch in browser and Https in Nodejs |
| 27 | + */ |
| 28 | + httpHandler?: HttpHandler; |
| 29 | + |
| 30 | + /** |
| 31 | + * 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 |
| 32 | + */ |
| 33 | + sha256?: HashConstructor; |
| 34 | + |
| 35 | + /** |
| 36 | + * Default credentials provider; Not available in browser runtime |
| 37 | + */ |
| 38 | + credentialDefaultProvider?: (input: any) => Provider<Credentials>; |
| 39 | + |
| 40 | + /** |
| 41 | + * Provider function that return promise of a region string |
| 42 | + */ |
| 43 | + regionDefaultProvider?: (input: any) => Provider<string>; |
| 44 | + |
| 45 | + /** |
| 46 | + * The function that will be used to convert strings into HTTP endpoints |
| 47 | + */ |
| 48 | + urlParser?: UrlParser; |
| 49 | + |
| 50 | + /** |
| 51 | + * A function that can calculate the length of a request body. |
| 52 | + */ |
| 53 | + bodyLengthChecker?: (body: any) => number | undefined; |
| 54 | + |
| 55 | + /** |
| 56 | + * A function that converts a stream into an array of bytes. |
| 57 | + */ |
| 58 | + streamCollector?: StreamCollector; |
| 59 | + |
| 60 | + /** |
| 61 | + * The function that will be used to convert a base64-encoded string to a byte array |
| 62 | + */ |
| 63 | + base64Decoder?: Decoder; |
| 64 | + |
| 65 | + /** |
| 66 | + * The function that will be used to convert binary data to a base64-encoded string |
| 67 | + */ |
| 68 | + base64Encoder?: Encoder; |
| 69 | + |
| 70 | + /** |
| 71 | + * The function that will be used to convert a UTF8-encoded string to a byte array |
| 72 | + */ |
| 73 | + utf8Decoder?: Decoder; |
| 74 | + |
| 75 | + /** |
| 76 | + * The function that will be used to convert binary data to a UTF-8 encoded string |
| 77 | + */ |
| 78 | + utf8Encoder?: Encoder; |
| 79 | + |
| 80 | + /** |
| 81 | + * The function that will be used to populate default value in 'User-Agent' header |
| 82 | + */ |
| 83 | + defaultUserAgent?: string; |
| 84 | + |
| 85 | + /** |
| 86 | + * The function that will be used to populate serializing protocol |
| 87 | + */ |
| 88 | + protocolDefaultProvider?: ( |
| 89 | + handler: HttpHandler |
| 90 | + ) => Protocol<HttpRequest, HttpResponse>; |
| 91 | + |
| 92 | + /** |
| 93 | + * The service name with which to sign requests. |
| 94 | + */ |
| 95 | + signingName?: string; |
| 96 | + |
| 97 | + /** |
| 98 | + * The service name with which to construct endpoints. |
| 99 | + */ |
| 100 | + service?: string; |
| 101 | +} |
25 | 102 |
|
26 |
| -export type AWSClientRuntimeResolvedConfiguration = Required< |
27 |
| - AWSClientRuntimeConfiguration |
28 |
| ->; |
29 |
| - |
30 |
| -export const RDSRuntimeConfiguration: AWSClientRuntimeResolvedConfiguration = { |
31 |
| - protocolDefaultProvider: handler => new RestJsonProtocol(handler), |
32 |
| - signingName: "rds-data", |
33 |
| - service: "rds-data", |
34 |
| - httpHandler: new NodeHttpHandler(), |
35 |
| - sha256: Hash.bind(null, "sha256"), |
36 |
| - credentialDefaultProvider, |
37 |
| - regionDefaultProvider, |
38 |
| - urlParser: parseUrl, |
39 |
| - bodyLengthChecker: calculateBodyLength, |
40 |
| - streamCollector, |
41 |
| - base64Decoder: fromBase64, |
42 |
| - base64Encoder: toBase64, |
43 |
| - utf8Decoder: fromUtf8, |
44 |
| - utf8Encoder: toUtf8, |
45 |
| - defaultUserAgent: defaultUserAgent(name, version) |
46 |
| -}; |
47 |
| - |
48 |
| -export type RDSDataConfiguration = AWSClientRuntimeConfiguration & |
| 103 | +export type RDSDataConfiguration = RDSDataRuntimeDependencies & |
49 | 104 | AwsAuthInput &
|
50 | 105 | RegionInput &
|
51 | 106 | RetryInput &
|
52 | 107 | EndpointsInput &
|
53 | 108 | ClientProtocolInput &
|
54 | 109 | UserAgentInput;
|
55 | 110 |
|
56 |
| -export type RDSDataResolvedConfiguration = AWSClientRuntimeResolvedConfiguration & |
| 111 | +export type RDSDataResolvedConfiguration = Required< |
| 112 | + RDSDataRuntimeDependencies |
| 113 | +> & |
57 | 114 | AwsAuth.Resolved &
|
58 | 115 | Region.Resolved &
|
59 | 116 | Retry.Resolved &
|
|
0 commit comments