Skip to content

Commit d77322a

Browse files
author
awstools
committed
feat(client-iotsecuretunneling): This release introduces a new API RotateTunnelAccessToken that allow revoking the existing tokens and generate new tokens
1 parent 95abe4b commit d77322a

File tree

12 files changed

+484
-73
lines changed

12 files changed

+484
-73
lines changed

clients/client-iotsecuretunneling/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
AWS SDK for JavaScript IoTSecureTunneling Client for Node.js, Browser and React Native.
99

10-
<fullname>AWS IoT Secure Tunneling</fullname>
10+
<fullname>IoT Secure Tunneling</fullname>
1111

12-
<p>AWS IoT Secure Tunnling enables you to create remote connections to devices
13-
deployed in the field.</p>
14-
15-
<p>For more information about how AWS IoT Secure Tunneling works, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html">AWS IoT Secure Tunneling</a>.</p>
12+
<p>IoT Secure Tunneling creates remote connections to devices deployed in the
13+
field.</p>
14+
<p>For more information about how IoT Secure Tunneling works, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html">IoT
15+
Secure Tunneling</a>.</p>
1616

1717
## Installing
1818

clients/client-iotsecuretunneling/src/IoTSecureTunneling.ts

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import {
1313
} from "./commands/ListTagsForResourceCommand";
1414
import { ListTunnelsCommand, ListTunnelsCommandInput, ListTunnelsCommandOutput } from "./commands/ListTunnelsCommand";
1515
import { OpenTunnelCommand, OpenTunnelCommandInput, OpenTunnelCommandOutput } from "./commands/OpenTunnelCommand";
16+
import {
17+
RotateTunnelAccessTokenCommand,
18+
RotateTunnelAccessTokenCommandInput,
19+
RotateTunnelAccessTokenCommandOutput,
20+
} from "./commands/RotateTunnelAccessTokenCommand";
1621
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
1722
import {
1823
UntagResourceCommand,
@@ -22,17 +27,18 @@ import {
2227
import { IoTSecureTunnelingClient } from "./IoTSecureTunnelingClient";
2328

2429
/**
25-
* <fullname>AWS IoT Secure Tunneling</fullname>
26-
* <p>AWS IoT Secure Tunnling enables you to create remote connections to devices
27-
* deployed in the field.</p>
28-
*
29-
* <p>For more information about how AWS IoT Secure Tunneling works, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html">AWS IoT Secure Tunneling</a>.</p>
30+
* <fullname>IoT Secure Tunneling</fullname>
31+
* <p>IoT Secure Tunneling creates remote connections to devices deployed in the
32+
* field.</p>
33+
* <p>For more information about how IoT Secure Tunneling works, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html">IoT
34+
* Secure Tunneling</a>.</p>
3035
*/
3136
export class IoTSecureTunneling extends IoTSecureTunnelingClient {
3237
/**
3338
* <p>Closes a tunnel identified by the unique tunnel id. When a <code>CloseTunnel</code>
3439
* request is received, we close the WebSocket connections between the client and proxy
3540
* server so no data can be transmitted.</p>
41+
* <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CloseTunnel</a> action.</p>
3642
*/
3743
public closeTunnel(args: CloseTunnelCommandInput, options?: __HttpHandlerOptions): Promise<CloseTunnelCommandOutput>;
3844
public closeTunnel(args: CloseTunnelCommandInput, cb: (err: any, data?: CloseTunnelCommandOutput) => void): void;
@@ -59,6 +65,7 @@ export class IoTSecureTunneling extends IoTSecureTunnelingClient {
5965

6066
/**
6167
* <p>Gets information about a tunnel identified by the unique tunnel id.</p>
68+
* <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">DescribeTunnel</a> action.</p>
6269
*/
6370
public describeTunnel(
6471
args: DescribeTunnelCommandInput,
@@ -122,8 +129,9 @@ export class IoTSecureTunneling extends IoTSecureTunnelingClient {
122129
}
123130

124131
/**
125-
* <p>List all tunnels for an AWS account. Tunnels are listed by creation time in
132+
* <p>List all tunnels for an Amazon Web Services account. Tunnels are listed by creation time in
126133
* descending order, newer tunnels will be listed before older tunnels.</p>
134+
* <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">ListTunnels</a> action.</p>
127135
*/
128136
public listTunnels(args: ListTunnelsCommandInput, options?: __HttpHandlerOptions): Promise<ListTunnelsCommandOutput>;
129137
public listTunnels(args: ListTunnelsCommandInput, cb: (err: any, data?: ListTunnelsCommandOutput) => void): void;
@@ -150,7 +158,8 @@ export class IoTSecureTunneling extends IoTSecureTunnelingClient {
150158

151159
/**
152160
* <p>Creates a new tunnel, and returns two client access tokens for clients to use to
153-
* connect to the AWS IoT Secure Tunneling proxy server.</p>
161+
* connect to the IoT Secure Tunneling proxy server.</p>
162+
* <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">OpenTunnel</a> action.</p>
154163
*/
155164
public openTunnel(args: OpenTunnelCommandInput, options?: __HttpHandlerOptions): Promise<OpenTunnelCommandOutput>;
156165
public openTunnel(args: OpenTunnelCommandInput, cb: (err: any, data?: OpenTunnelCommandOutput) => void): void;
@@ -175,6 +184,46 @@ export class IoTSecureTunneling extends IoTSecureTunnelingClient {
175184
}
176185
}
177186

187+
/**
188+
* <p>Revokes the current client access token (CAT) and returns new CAT for clients to
189+
* use when reconnecting to secure tunneling to access the same tunnel.</p>
190+
* <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">RotateTunnelAccessToken</a> action.</p>
191+
* <note>
192+
* <p>Rotating the CAT doesn't extend the tunnel duration. For example, say the tunnel
193+
* duration is 12 hours and the tunnel has already been open for 4 hours. When you
194+
* rotate the access tokens, the new tokens that are generated can only be used for the
195+
* remaining 8 hours.</p>
196+
* </note>
197+
*/
198+
public rotateTunnelAccessToken(
199+
args: RotateTunnelAccessTokenCommandInput,
200+
options?: __HttpHandlerOptions
201+
): Promise<RotateTunnelAccessTokenCommandOutput>;
202+
public rotateTunnelAccessToken(
203+
args: RotateTunnelAccessTokenCommandInput,
204+
cb: (err: any, data?: RotateTunnelAccessTokenCommandOutput) => void
205+
): void;
206+
public rotateTunnelAccessToken(
207+
args: RotateTunnelAccessTokenCommandInput,
208+
options: __HttpHandlerOptions,
209+
cb: (err: any, data?: RotateTunnelAccessTokenCommandOutput) => void
210+
): void;
211+
public rotateTunnelAccessToken(
212+
args: RotateTunnelAccessTokenCommandInput,
213+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RotateTunnelAccessTokenCommandOutput) => void),
214+
cb?: (err: any, data?: RotateTunnelAccessTokenCommandOutput) => void
215+
): Promise<RotateTunnelAccessTokenCommandOutput> | void {
216+
const command = new RotateTunnelAccessTokenCommand(args);
217+
if (typeof optionsOrCb === "function") {
218+
this.send(command, optionsOrCb);
219+
} else if (typeof cb === "function") {
220+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
221+
this.send(command, optionsOrCb || {}, cb);
222+
} else {
223+
return this.send(command, optionsOrCb);
224+
}
225+
}
226+
178227
/**
179228
* <p>A resource tag.</p>
180229
*/

clients/client-iotsecuretunneling/src/IoTSecureTunnelingClient.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ import {
5959
} from "./commands/ListTagsForResourceCommand";
6060
import { ListTunnelsCommandInput, ListTunnelsCommandOutput } from "./commands/ListTunnelsCommand";
6161
import { OpenTunnelCommandInput, OpenTunnelCommandOutput } from "./commands/OpenTunnelCommand";
62+
import {
63+
RotateTunnelAccessTokenCommandInput,
64+
RotateTunnelAccessTokenCommandOutput,
65+
} from "./commands/RotateTunnelAccessTokenCommand";
6266
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
6367
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
6468
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
@@ -69,6 +73,7 @@ export type ServiceInputTypes =
6973
| ListTagsForResourceCommandInput
7074
| ListTunnelsCommandInput
7175
| OpenTunnelCommandInput
76+
| RotateTunnelAccessTokenCommandInput
7277
| TagResourceCommandInput
7378
| UntagResourceCommandInput;
7479

@@ -78,6 +83,7 @@ export type ServiceOutputTypes =
7883
| ListTagsForResourceCommandOutput
7984
| ListTunnelsCommandOutput
8085
| OpenTunnelCommandOutput
86+
| RotateTunnelAccessTokenCommandOutput
8187
| TagResourceCommandOutput
8288
| UntagResourceCommandOutput;
8389

@@ -235,11 +241,11 @@ type IoTSecureTunnelingClientResolvedConfigType = __SmithyResolvedConfiguration<
235241
export interface IoTSecureTunnelingClientResolvedConfig extends IoTSecureTunnelingClientResolvedConfigType {}
236242

237243
/**
238-
* <fullname>AWS IoT Secure Tunneling</fullname>
239-
* <p>AWS IoT Secure Tunnling enables you to create remote connections to devices
240-
* deployed in the field.</p>
241-
*
242-
* <p>For more information about how AWS IoT Secure Tunneling works, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html">AWS IoT Secure Tunneling</a>.</p>
244+
* <fullname>IoT Secure Tunneling</fullname>
245+
* <p>IoT Secure Tunneling creates remote connections to devices deployed in the
246+
* field.</p>
247+
* <p>For more information about how IoT Secure Tunneling works, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html">IoT
248+
* Secure Tunneling</a>.</p>
243249
*/
244250
export class IoTSecureTunnelingClient extends __Client<
245251
__HttpHandlerOptions,

clients/client-iotsecuretunneling/src/commands/CloseTunnelCommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export interface CloseTunnelCommandOutput extends CloseTunnelResponse, __Metadat
2929
* <p>Closes a tunnel identified by the unique tunnel id. When a <code>CloseTunnel</code>
3030
* request is received, we close the WebSocket connections between the client and proxy
3131
* server so no data can be transmitted.</p>
32+
* <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CloseTunnel</a> action.</p>
3233
* @example
3334
* Use a bare-bones client and the command you need to make an API call.
3435
* ```javascript

clients/client-iotsecuretunneling/src/commands/DescribeTunnelCommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface DescribeTunnelCommandOutput extends DescribeTunnelResponse, __M
2727

2828
/**
2929
* <p>Gets information about a tunnel identified by the unique tunnel id.</p>
30+
* <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">DescribeTunnel</a> action.</p>
3031
* @example
3132
* Use a bare-bones client and the command you need to make an API call.
3233
* ```javascript

clients/client-iotsecuretunneling/src/commands/ListTunnelsCommand.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ export interface ListTunnelsCommandInput extends ListTunnelsRequest {}
2626
export interface ListTunnelsCommandOutput extends ListTunnelsResponse, __MetadataBearer {}
2727

2828
/**
29-
* <p>List all tunnels for an AWS account. Tunnels are listed by creation time in
29+
* <p>List all tunnels for an Amazon Web Services account. Tunnels are listed by creation time in
3030
* descending order, newer tunnels will be listed before older tunnels.</p>
31+
* <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">ListTunnels</a> action.</p>
3132
* @example
3233
* Use a bare-bones client and the command you need to make an API call.
3334
* ```javascript

clients/client-iotsecuretunneling/src/commands/OpenTunnelCommand.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export interface OpenTunnelCommandOutput extends OpenTunnelResponse, __MetadataB
2727

2828
/**
2929
* <p>Creates a new tunnel, and returns two client access tokens for clients to use to
30-
* connect to the AWS IoT Secure Tunneling proxy server.</p>
30+
* connect to the IoT Secure Tunneling proxy server.</p>
31+
* <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">OpenTunnel</a> action.</p>
3132
* @example
3233
* Use a bare-bones client and the command you need to make an API call.
3334
* ```javascript
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
2+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
3+
import { Command as $Command } from "@aws-sdk/smithy-client";
4+
import {
5+
FinalizeHandlerArguments,
6+
Handler,
7+
HandlerExecutionContext,
8+
HttpHandlerOptions as __HttpHandlerOptions,
9+
MetadataBearer as __MetadataBearer,
10+
MiddlewareStack,
11+
SerdeContext as __SerdeContext,
12+
} from "@aws-sdk/types";
13+
14+
import {
15+
IoTSecureTunnelingClientResolvedConfig,
16+
ServiceInputTypes,
17+
ServiceOutputTypes,
18+
} from "../IoTSecureTunnelingClient";
19+
import { RotateTunnelAccessTokenRequest, RotateTunnelAccessTokenResponse } from "../models/models_0";
20+
import {
21+
deserializeAws_json1_1RotateTunnelAccessTokenCommand,
22+
serializeAws_json1_1RotateTunnelAccessTokenCommand,
23+
} from "../protocols/Aws_json1_1";
24+
25+
export interface RotateTunnelAccessTokenCommandInput extends RotateTunnelAccessTokenRequest {}
26+
export interface RotateTunnelAccessTokenCommandOutput extends RotateTunnelAccessTokenResponse, __MetadataBearer {}
27+
28+
/**
29+
* <p>Revokes the current client access token (CAT) and returns new CAT for clients to
30+
* use when reconnecting to secure tunneling to access the same tunnel.</p>
31+
* <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">RotateTunnelAccessToken</a> action.</p>
32+
* <note>
33+
* <p>Rotating the CAT doesn't extend the tunnel duration. For example, say the tunnel
34+
* duration is 12 hours and the tunnel has already been open for 4 hours. When you
35+
* rotate the access tokens, the new tokens that are generated can only be used for the
36+
* remaining 8 hours.</p>
37+
* </note>
38+
* @example
39+
* Use a bare-bones client and the command you need to make an API call.
40+
* ```javascript
41+
* import { IoTSecureTunnelingClient, RotateTunnelAccessTokenCommand } from "@aws-sdk/client-iotsecuretunneling"; // ES Modules import
42+
* // const { IoTSecureTunnelingClient, RotateTunnelAccessTokenCommand } = require("@aws-sdk/client-iotsecuretunneling"); // CommonJS import
43+
* const client = new IoTSecureTunnelingClient(config);
44+
* const command = new RotateTunnelAccessTokenCommand(input);
45+
* const response = await client.send(command);
46+
* ```
47+
*
48+
* @see {@link RotateTunnelAccessTokenCommandInput} for command's `input` shape.
49+
* @see {@link RotateTunnelAccessTokenCommandOutput} for command's `response` shape.
50+
* @see {@link IoTSecureTunnelingClientResolvedConfig | config} for IoTSecureTunnelingClient's `config` shape.
51+
*
52+
*/
53+
export class RotateTunnelAccessTokenCommand extends $Command<
54+
RotateTunnelAccessTokenCommandInput,
55+
RotateTunnelAccessTokenCommandOutput,
56+
IoTSecureTunnelingClientResolvedConfig
57+
> {
58+
// Start section: command_properties
59+
// End section: command_properties
60+
61+
constructor(readonly input: RotateTunnelAccessTokenCommandInput) {
62+
// Start section: command_constructor
63+
super();
64+
// End section: command_constructor
65+
}
66+
67+
/**
68+
* @internal
69+
*/
70+
resolveMiddleware(
71+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
72+
configuration: IoTSecureTunnelingClientResolvedConfig,
73+
options?: __HttpHandlerOptions
74+
): Handler<RotateTunnelAccessTokenCommandInput, RotateTunnelAccessTokenCommandOutput> {
75+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
76+
77+
const stack = clientStack.concat(this.middlewareStack);
78+
79+
const { logger } = configuration;
80+
const clientName = "IoTSecureTunnelingClient";
81+
const commandName = "RotateTunnelAccessTokenCommand";
82+
const handlerExecutionContext: HandlerExecutionContext = {
83+
logger,
84+
clientName,
85+
commandName,
86+
inputFilterSensitiveLog: RotateTunnelAccessTokenRequest.filterSensitiveLog,
87+
outputFilterSensitiveLog: RotateTunnelAccessTokenResponse.filterSensitiveLog,
88+
};
89+
const { requestHandler } = configuration;
90+
return stack.resolve(
91+
(request: FinalizeHandlerArguments<any>) =>
92+
requestHandler.handle(request.request as __HttpRequest, options || {}),
93+
handlerExecutionContext
94+
);
95+
}
96+
97+
private serialize(input: RotateTunnelAccessTokenCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
98+
return serializeAws_json1_1RotateTunnelAccessTokenCommand(input, context);
99+
}
100+
101+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<RotateTunnelAccessTokenCommandOutput> {
102+
return deserializeAws_json1_1RotateTunnelAccessTokenCommand(output, context);
103+
}
104+
105+
// Start section: command_body_extra
106+
// End section: command_body_extra
107+
}

clients/client-iotsecuretunneling/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ export * from "./DescribeTunnelCommand";
33
export * from "./ListTagsForResourceCommand";
44
export * from "./ListTunnelsCommand";
55
export * from "./OpenTunnelCommand";
6+
export * from "./RotateTunnelAccessTokenCommand";
67
export * from "./TagResourceCommand";
78
export * from "./UntagResourceCommand";

0 commit comments

Comments
 (0)