Skip to content

Commit 22cd908

Browse files
Chase Coalwelltrivikr
Chase Coalwell
authored andcommitted
chore: update rds-data client (#616)
1 parent c43de93 commit 22cd908

15 files changed

+395
-448
lines changed

clients/client-rds-data/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
189+
Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

clients/client-rds-data/RDSData.ts

Lines changed: 143 additions & 132 deletions
Large diffs are not rendered by default.

clients/client-rds-data/RDSDataClient.ts

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ import {
2222
resolveRegionConfig
2323
} from "@aws-sdk/config-resolver";
2424
import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length";
25+
import {
26+
HostHeaderInputConfig,
27+
HostHeaderResolvedConfig,
28+
getHostHeaderPlugin,
29+
resolveHostHeaderConfig
30+
} from "@aws-sdk/middleware-host-header";
2531
import {
2632
RetryInputConfig,
2733
RetryResolvedConfig,
@@ -47,15 +53,15 @@ import {
4753
SmithyResolvedConfiguration as __SmithyResolvedConfiguration
4854
} from "@aws-sdk/smithy-client";
4955
import {
56+
RegionInfoProvider,
5057
Credentials as __Credentials,
5158
Decoder as __Decoder,
5259
Encoder as __Encoder,
5360
HashConstructor as __HashConstructor,
5461
HttpHandlerOptions as __HttpHandlerOptions,
5562
Provider as __Provider,
5663
StreamCollector as __StreamCollector,
57-
UrlParser as __UrlParser,
58-
RegionInfoProvider
64+
UrlParser as __UrlParser
5965
} from "@aws-sdk/types";
6066

6167
export type ServiceInputTypes =
@@ -123,10 +129,15 @@ export interface ClientDefaults
123129
utf8Encoder?: __Encoder;
124130

125131
/**
126-
* The function that will be used to populate default value in 'User-Agent' header
132+
* The string that will be used to populate default value in 'User-Agent' header
127133
*/
128134
defaultUserAgent?: string;
129135

136+
/**
137+
* The runtime environment
138+
*/
139+
runtime?: string;
140+
130141
/**
131142
* The service name with which to sign requests.
132143
*/
@@ -143,7 +154,7 @@ export interface ClientDefaults
143154
regionDefaultProvider?: (input: any) => __Provider<string>;
144155

145156
/**
146-
* Fetch hostname, signing name or signing region of given region
157+
* Fetch related hostname, signing name or signing region with given region.
147158
*/
148159
regionInfoProvider?: RegionInfoProvider;
149160
}
@@ -153,20 +164,22 @@ export type RDSDataClientConfig = Partial<
153164
> &
154165
ClientDefaults &
155166
RegionInputConfig &
156-
AwsAuthInputConfig &
157167
EndpointsInputConfig &
168+
AwsAuthInputConfig &
158169
RetryInputConfig &
159-
UserAgentInputConfig;
170+
UserAgentInputConfig &
171+
HostHeaderInputConfig;
160172

161173
export type RDSDataClientResolvedConfig = __SmithyResolvedConfiguration<
162174
__HttpHandlerOptions
163175
> &
164176
Required<ClientDefaults> &
165177
RegionResolvedConfig &
166-
AwsAuthResolvedConfig &
167178
EndpointsResolvedConfig &
179+
AwsAuthResolvedConfig &
168180
RetryResolvedConfig &
169-
UserAgentResolvedConfig;
181+
UserAgentResolvedConfig &
182+
HostHeaderResolvedConfig;
170183

171184
/**
172185
* <fullname>Amazon RDS Data Service</fullname>
@@ -194,16 +207,18 @@ export class RDSDataClient extends __Client<
194207
...configuration
195208
};
196209
let _config_1 = resolveRegionConfig(_config_0);
197-
let _config_2 = resolveAwsAuthConfig(_config_1);
198-
let _config_3 = resolveEndpointsConfig(_config_2);
210+
let _config_2 = resolveEndpointsConfig(_config_1);
211+
let _config_3 = resolveAwsAuthConfig(_config_2);
199212
let _config_4 = resolveRetryConfig(_config_3);
200213
let _config_5 = resolveUserAgentConfig(_config_4);
201-
super(_config_5);
202-
this.config = _config_5;
214+
let _config_6 = resolveHostHeaderConfig(_config_5);
215+
super(_config_6);
216+
this.config = _config_6;
203217
this.middlewareStack.use(getAwsAuthPlugin(this.config));
204218
this.middlewareStack.use(getRetryPlugin(this.config));
205219
this.middlewareStack.use(getUserAgentPlugin(this.config));
206220
this.middlewareStack.use(getContentLengthPlugin(this.config));
221+
this.middlewareStack.use(getHostHeaderPlugin(this.config));
207222
}
208223

209224
destroy(): void {}

clients/client-rds-data/README.md

Lines changed: 2 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,6 @@
1-
# @aws-sdk/client-rds-data
1+
@aws-sdk/client-rds-data
22

33
[![NPM version](https://img.shields.io/npm/v/@aws-sdk/client-rds-data/preview.svg)](https://www.npmjs.com/package/@aws-sdk/client-rds-data)
44
[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/client-rds-data.svg)](https://www.npmjs.com/package/@aws-sdk/client-rds-data)
55

6-
## Description
7-
8-
<fullname>Amazon RDS Data Service</fullname>
9-
10-
<p>Amazon RDS provides an HTTP endpoint to run SQL statements on an Amazon Aurora
11-
Serverless DB cluster. To run these statements, you work with the Data Service
12-
API.</p>
13-
<p>For more information about the Data Service API, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html">Using the Data API for Aurora
14-
Serverless</a> in the <i>Amazon Aurora User Guide</i>.</p>
15-
16-
## Installing
17-
18-
To install the this package using NPM, simply type the following into a terminal window:
19-
20-
```
21-
npm install @aws-sdk/client-rds-data
22-
```
23-
24-
## Getting Started
25-
26-
### Import
27-
28-
The AWS SDK is modulized by clients and commands in CommonJS modules. To send a request, you only need to import the client(`RdsDataServiceClient`) and the commands you need, for example `BatchExecuteStatementCommand`:
29-
30-
```javascript
31-
//JavaScript
32-
const {
33-
RdsDataServiceClient,
34-
BatchExecuteStatementCommand
35-
} = require("@aws-sdk/client-rds-data");
36-
```
37-
38-
```javascript
39-
//TypeScript
40-
import {
41-
RdsDataServiceClient,
42-
BatchExecuteStatementCommand
43-
} from "@aws-sdk/client-rds-data";
44-
```
45-
46-
### Usage
47-
48-
To send a request, you:
49-
50-
- Initiate client with configuration (e.g. credentials, region). For more information you can refer to the [API reference][].
51-
- Initiate command with input parameters.
52-
- Call `send` operation on client with command object as input.
53-
- If you are using a custom http handler, you may call `destroy()` to close open connections.
54-
55-
```javascript
56-
const rDSData = new RdsDataServiceClient({region: 'region'});
57-
//clients can be shared by different commands
58-
const params = {
59-
resourceArn: /**a string value*/,
60-
secretArn: /**a string value*/,
61-
sql: /**a string value*/,
62-
};
63-
const batchExecuteStatementCommand = new BatchExecuteStatementCommand(params);
64-
rDSData.send(batchExecuteStatementCommand).then(data => {
65-
// do something
66-
}).catch(error => {
67-
// error handling
68-
})
69-
```
70-
71-
In addition to using promises, there are 2 other ways to send a request:
72-
73-
```javascript
74-
// async/await
75-
try {
76-
const data = await rDSData.send(batchExecuteStatementCommand);
77-
// do something
78-
} catch (error) {
79-
// error handling
80-
}
81-
```
82-
83-
```javascript
84-
// callback
85-
rDSData.send(batchExecuteStatementCommand, (err, data) => {
86-
//do something
87-
});
88-
```
89-
90-
### Troubleshooting
91-
92-
When the service returns an exception, the error will include the exception information, as well as response metadata (e.g. request id).
93-
94-
```javascript
95-
try {
96-
const data = await rDSData.send(batchExecuteStatementCommand);
97-
// do something
98-
} catch (error) {
99-
const metadata = error.$metadata;
100-
console.log(
101-
`requestId: ${metadata.requestId}
102-
cfId: ${metadata.cfId}
103-
extendedRequestId: ${metadata.extendedRequestId}`
104-
);
105-
/*
106-
The keys within exceptions are also parsed. You can access them by specifying exception names:
107-
if(error.name === 'SomeServiceException') {
108-
const value = error.specialKeyInException;
109-
}
110-
*/
111-
}
112-
```
113-
114-
## Getting Help
115-
116-
Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them.
117-
118-
- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js) and tag it with `aws-sdk-js`
119-
- Come join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3)
120-
- If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues)
121-
122-
## Contributing
123-
124-
This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/@aws-sdk/client-rds-data' package is updated. To contribute to SDK you can checkout our [code generator package][].
125-
126-
## License
127-
128-
This SDK is distributed under the
129-
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0),
130-
see LICENSE for more information.
131-
132-
[code generator package]: https://github.com/aws/aws-sdk-js-v3/tree/master/packages/service-types-generator
133-
[api reference]: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/
6+
For SDK usage, please step to [SDK reademe](https://github.com/aws/aws-sdk-js-v3).

clients/client-rds-data/endpoints.ts

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { RegionInfo, RegionInfoProvider } from "@aws-sdk/types";
1+
import {
2+
RegionInfo,
3+
RegionInfoProvider,
4+
} from "@aws-sdk/types";
25

36
// Partition default templates
47
const AWS_TEMPLATE = "rds-data.{region}.amazonaws.com";
@@ -26,12 +29,22 @@ const AWS_REGIONS = new Set([
2629
"us-east-1",
2730
"us-east-2",
2831
"us-west-1",
29-
"us-west-2"
32+
"us-west-2",
33+
]);
34+
const AWS_CN_REGIONS = new Set([
35+
"cn-north-1",
36+
"cn-northwest-1",
37+
]);
38+
const AWS_ISO_REGIONS = new Set([
39+
"us-iso-east-1",
40+
]);
41+
const AWS_ISO_B_REGIONS = new Set([
42+
"us-isob-east-1",
43+
]);
44+
const AWS_US_GOV_REGIONS = new Set([
45+
"us-gov-west-1",
46+
"us-gov-east-1",
3047
]);
31-
const AWS_CN_REGIONS = new Set(["cn-north-1", "cn-northwest-1"]);
32-
const AWS_ISO_REGIONS = new Set(["us-iso-east-1"]);
33-
const AWS_ISO_B_REGIONS = new Set(["us-isob-east-1"]);
34-
const AWS_US_GOV_REGIONS = new Set(["us-gov-west-1", "us-gov-east-1"]);
3548

3649
export const defaultRegionInfoProvider: RegionInfoProvider = (
3750
region: string,
@@ -44,33 +57,33 @@ export const defaultRegionInfoProvider: RegionInfoProvider = (
4457
default:
4558
if (AWS_REGIONS.has(region)) {
4659
regionInfo = {
47-
hostname: AWS_TEMPLATE.replace("{region}", region)
60+
hostname: AWS_TEMPLATE.replace("{region}", region),
4861
};
4962
}
5063
if (AWS_CN_REGIONS.has(region)) {
5164
regionInfo = {
52-
hostname: AWS_CN_TEMPLATE.replace("{region}", region)
65+
hostname: AWS_CN_TEMPLATE.replace("{region}", region),
5366
};
5467
}
5568
if (AWS_ISO_REGIONS.has(region)) {
5669
regionInfo = {
57-
hostname: AWS_ISO_TEMPLATE.replace("{region}", region)
70+
hostname: AWS_ISO_TEMPLATE.replace("{region}", region),
5871
};
5972
}
6073
if (AWS_ISO_B_REGIONS.has(region)) {
6174
regionInfo = {
62-
hostname: AWS_ISO_B_TEMPLATE.replace("{region}", region)
75+
hostname: AWS_ISO_B_TEMPLATE.replace("{region}", region),
6376
};
6477
}
6578
if (AWS_US_GOV_REGIONS.has(region)) {
6679
regionInfo = {
67-
hostname: AWS_US_GOV_TEMPLATE.replace("{region}", region)
80+
hostname: AWS_US_GOV_TEMPLATE.replace("{region}", region),
6881
};
6982
}
7083
// Finally, assume it's an AWS partition endpoint.
7184
if (regionInfo === undefined) {
7285
regionInfo = {
73-
hostname: AWS_TEMPLATE.replace("{region}", region)
86+
hostname: AWS_TEMPLATE.replace("{region}", region),
7487
};
7588
}
7689
}

clients/client-rds-data/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export * from "./RDSDataClient";
22
export * from "./RDSData";
3-
export * from "./commands/BatchExecuteStatementCommand";
4-
export * from "./commands/ExecuteStatementCommand";
53
export * from "./commands/CommitTransactionCommand";
6-
export * from "./commands/RollbackTransactionCommand";
74
export * from "./commands/BeginTransactionCommand";
5+
export * from "./commands/BatchExecuteStatementCommand";
6+
export * from "./commands/RollbackTransactionCommand";
87
export * from "./commands/ExecuteSqlCommand";
8+
export * from "./commands/ExecuteStatementCommand";

clients/client-rds-data/models/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as _smithy from "../lib/smithy";
1+
import * as _smithy from "@aws-sdk/smithy-client";
22
import { MetadataBearer as $MetadataBearer } from "@aws-sdk/types";
33

44
/**

0 commit comments

Comments
 (0)