-
Notifications
You must be signed in to change notification settings - Fork 673
Expand file tree
/
Copy pathRdsDataServiceClient.ts
More file actions
199 lines (177 loc) · 5.11 KB
/
RdsDataServiceClient.ts
File metadata and controls
199 lines (177 loc) · 5.11 KB
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
import {
BatchExecuteStatementRequest,
BatchExecuteStatementResponse,
BeginTransactionRequest,
BeginTransactionResponse,
CommitTransactionRequest,
CommitTransactionResponse,
ExecuteSqlRequest,
ExecuteSqlResponse,
ExecuteStatementRequest,
ExecuteStatementResponse,
RollbackTransactionRequest,
RollbackTransactionResponse
} from "./models/index";
import { RDSRuntimeConfiguration } from "./runtimeConfig";
import {
Credentials,
Provider,
HashConstructor,
UrlParser,
StreamCollector,
Decoder,
Encoder
} from "@aws-sdk/types";
import {
EndpointsConfigInput,
EndpointsConfigResolved,
resolveEndpointsConfig,
destroyRequestHandlerConfig,
RegionConfigInput,
RegionConfigResolved,
resolveRegionConfig
} from "@aws-sdk/config-resolver";
import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length";
import {
UserAgentConfigInput,
UserAgentConfigResolved,
resolveUserAgentConfig,
getUserAgentPlugin
} from "@aws-sdk/middleware-user-agent";
import {
RetryConfigInput,
RetryConfigResolved,
resolveRetryConfig,
getRetryPlugin
} from "@aws-sdk/middleware-retry";
import {
AwsAuthConfigInput,
AwsAuthConfigResolved,
resolveAwsAuthConfig,
getAwsAuthPlugin
} from "@aws-sdk/middleware-signing";
import { HttpHandler } from "@aws-sdk/protocol-http";
import {
Client as SmithyClient,
SmithyResolvedConfiguration
} from "@aws-sdk/smithy-client";
import { HttpOptions as __HttpOptions } from "@aws-sdk/types";
export type ServiceInputTypes =
| RollbackTransactionRequest
| CommitTransactionRequest
| ExecuteSqlRequest
| BeginTransactionRequest
| ExecuteStatementRequest
| BatchExecuteStatementRequest;
export type ServiceOutputTypes =
| RollbackTransactionResponse
| CommitTransactionResponse
| ExecuteSqlResponse
| BeginTransactionResponse
| ExecuteStatementResponse
| BatchExecuteStatementResponse;
export interface RDSDataRuntimeDependencies {
/**
* The function that will be used to populate serializing protocol
*/
protocol: string;
/**
* The HTTP handler to use. Fetch in browser and Https in Nodejs
*/
requestHandler?: HttpHandler;
/**
* 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?: HashConstructor;
/**
* Default credentials provider; Not available in browser runtime
*/
credentialDefaultProvider?: (input: any) => Provider<Credentials>;
/**
* Provider function that return promise of a region string
*/
regionDefaultProvider?: (input: any) => Provider<string>;
/**
* The function that will be used to convert strings into HTTP endpoints
*/
urlParser?: UrlParser;
/**
* A function that can calculate the length of a request body.
*/
bodyLengthChecker?: (body: any) => number | undefined;
/**
* A function that converts a stream into an array of bytes.
*/
streamCollector?: StreamCollector;
/**
* The function that will be used to convert a base64-encoded string to a byte array
*/
base64Decoder?: Decoder;
/**
* The function that will be used to convert binary data to a base64-encoded string
*/
base64Encoder?: Encoder;
/**
* The function that will be used to convert a UTF8-encoded string to a byte array
*/
utf8Decoder?: Decoder;
/**
* The function that will be used to convert binary data to a UTF-8 encoded string
*/
utf8Encoder?: Encoder;
/**
* The function that will be used to populate default value in 'User-Agent' header
*/
defaultUserAgent?: string;
/**
* The service name with which to sign requests.
*/
signingName?: string;
/**
* The service name with which to construct endpoints.
*/
service?: string;
}
export type RdsDataServiceConfig = RDSDataRuntimeDependencies &
AwsAuthConfigInput &
RegionConfigInput &
RetryConfigInput &
EndpointsConfigInput &
UserAgentConfigInput;
export type RdsDataServiceResolvedConfig = SmithyResolvedConfiguration<
__HttpOptions
> &
Required<RDSDataRuntimeDependencies> &
AwsAuthConfigResolved &
RegionConfigResolved &
RetryConfigResolved &
EndpointsConfigResolved &
UserAgentConfigResolved;
export class RdsDataService extends SmithyClient<
__HttpOptions,
ServiceInputTypes,
ServiceOutputTypes,
RdsDataServiceResolvedConfig
> {
readonly config: RdsDataServiceResolvedConfig;
constructor(configuration: RdsDataServiceConfig) {
const _config_0 = {
...RDSRuntimeConfiguration,
...configuration
};
let _config_1 = resolveRegionConfig(_config_0);
let _config_2 = resolveAwsAuthConfig(_config_1);
let _config_3 = resolveEndpointsConfig(_config_2);
let _config_4 = resolveRetryConfig(_config_3);
let _config_5 = resolveUserAgentConfig(_config_4);
super(_config_5);
this.config = _config_5;
this.middlewareStack.use(getContentLengthPlugin(this.config));
this.middlewareStack.use(getAwsAuthPlugin(this.config));
this.middlewareStack.use(getRetryPlugin(this.config));
this.middlewareStack.use(getUserAgentPlugin(this.config));
}
destroy(): void {
destroyRequestHandlerConfig(this.config);
}
}