Skip to content

Commit 3b3ce33

Browse files
author
awstools
committed
feat(client-iotdeviceadvisor): Add clientToken attribute and implement idempotency for CreateSuiteDefinition.
1 parent cea0513 commit 3b3ce33

File tree

5 files changed

+31
-1
lines changed

5 files changed

+31
-1
lines changed

clients/client-iotdeviceadvisor/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@
5858
"@smithy/util-middleware": "^3.0.7",
5959
"@smithy/util-retry": "^3.0.7",
6060
"@smithy/util-utf8": "^3.0.0",
61-
"tslib": "^2.6.2"
61+
"tslib": "^2.6.2",
62+
"uuid": "^9.0.1"
6263
},
6364
"devDependencies": {
6465
"@tsconfig/node16": "16.1.3",
6566
"@types/node": "^16.18.96",
67+
"@types/uuid": "^9.0.4",
6668
"concurrently": "7.0.0",
6769
"downlevel-dts": "0.10.1",
6870
"rimraf": "3.0.2",

clients/client-iotdeviceadvisor/src/commands/CreateSuiteDefinitionCommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export interface CreateSuiteDefinitionCommandOutput extends CreateSuiteDefinitio
5555
* tags: { // TagMap
5656
* "<keys>": "STRING_VALUE",
5757
* },
58+
* clientToken: "STRING_VALUE",
5859
* };
5960
* const command = new CreateSuiteDefinitionCommand(input);
6061
* const response = await client.send(command);

clients/client-iotdeviceadvisor/src/models/models_0.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ export interface CreateSuiteDefinitionRequest {
152152
* @public
153153
*/
154154
tags?: Record<string, string>;
155+
156+
/**
157+
* <p>The client token for the test suite definition creation.
158+
* This token is used for tracking test suite definition creation
159+
* using retries and obtaining its status. This parameter is optional.</p>
160+
* @public
161+
*/
162+
clientToken?: string;
155163
}
156164

157165
/**

clients/client-iotdeviceadvisor/src/protocols/Aws_restJson1.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
ResponseMetadata as __ResponseMetadata,
2525
SerdeContext as __SerdeContext,
2626
} from "@smithy/types";
27+
import { v4 as generateIdempotencyToken } from "uuid";
2728

2829
import {
2930
CreateSuiteDefinitionCommandInput,
@@ -85,6 +86,7 @@ export const se_CreateSuiteDefinitionCommand = async (
8586
let body: any;
8687
body = JSON.stringify(
8788
take(input, {
89+
clientToken: [true, (_) => _ ?? generateIdempotencyToken()],
8890
suiteDefinitionConfiguration: (_) => _json(_),
8991
tags: (_) => _json(_),
9092
})

codegen/sdk-codegen/aws-models/iotdeviceadvisor.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@
5555
}
5656
}
5757
},
58+
"com.amazonaws.iotdeviceadvisor#ClientToken": {
59+
"type": "string",
60+
"traits": {
61+
"smithy.api#length": {
62+
"min": 1,
63+
"max": 64
64+
},
65+
"smithy.api#pattern": "^[\\u0021-\\u007E]+$"
66+
}
67+
},
5868
"com.amazonaws.iotdeviceadvisor#ConflictException": {
5969
"type": "structure",
6070
"members": {
@@ -112,6 +122,13 @@
112122
"traits": {
113123
"smithy.api#documentation": "<p>The tags to be attached to the suite definition.</p>"
114124
}
125+
},
126+
"clientToken": {
127+
"target": "com.amazonaws.iotdeviceadvisor#ClientToken",
128+
"traits": {
129+
"smithy.api#documentation": "<p>The client token for the test suite definition creation. \n This token is used for tracking test suite definition creation \n using retries and obtaining its status. This parameter is optional.</p>",
130+
"smithy.api#idempotencyToken": {}
131+
}
115132
}
116133
},
117134
"traits": {

0 commit comments

Comments
 (0)