Skip to content

Commit

Permalink
feat(client-iotdeviceadvisor): Add clientToken attribute and implemen…
Browse files Browse the repository at this point in the history
…t idempotency for CreateSuiteDefinition.
  • Loading branch information
awstools committed Oct 2, 2024
1 parent cea0513 commit 3b3ce33
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clients/client-iotdeviceadvisor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@
"@smithy/util-middleware": "^3.0.7",
"@smithy/util-retry": "^3.0.7",
"@smithy/util-utf8": "^3.0.0",
"tslib": "^2.6.2"
"tslib": "^2.6.2",
"uuid": "^9.0.1"
},
"devDependencies": {
"@tsconfig/node16": "16.1.3",
"@types/node": "^16.18.96",
"@types/uuid": "^9.0.4",
"concurrently": "7.0.0",
"downlevel-dts": "0.10.1",
"rimraf": "3.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export interface CreateSuiteDefinitionCommandOutput extends CreateSuiteDefinitio
* tags: { // TagMap
* "<keys>": "STRING_VALUE",
* },
* clientToken: "STRING_VALUE",
* };
* const command = new CreateSuiteDefinitionCommand(input);
* const response = await client.send(command);
Expand Down
8 changes: 8 additions & 0 deletions clients/client-iotdeviceadvisor/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ export interface CreateSuiteDefinitionRequest {
* @public
*/
tags?: Record<string, string>;

/**
* <p>The client token for the test suite definition creation.
* This token is used for tracking test suite definition creation
* using retries and obtaining its status. This parameter is optional.</p>
* @public
*/
clientToken?: string;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
ResponseMetadata as __ResponseMetadata,
SerdeContext as __SerdeContext,
} from "@smithy/types";
import { v4 as generateIdempotencyToken } from "uuid";

import {
CreateSuiteDefinitionCommandInput,
Expand Down Expand Up @@ -85,6 +86,7 @@ export const se_CreateSuiteDefinitionCommand = async (
let body: any;
body = JSON.stringify(
take(input, {
clientToken: [true, (_) => _ ?? generateIdempotencyToken()],
suiteDefinitionConfiguration: (_) => _json(_),
tags: (_) => _json(_),
})
Expand Down
17 changes: 17 additions & 0 deletions codegen/sdk-codegen/aws-models/iotdeviceadvisor.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@
}
}
},
"com.amazonaws.iotdeviceadvisor#ClientToken": {
"type": "string",
"traits": {
"smithy.api#length": {
"min": 1,
"max": 64
},
"smithy.api#pattern": "^[\\u0021-\\u007E]+$"
}
},
"com.amazonaws.iotdeviceadvisor#ConflictException": {
"type": "structure",
"members": {
Expand Down Expand Up @@ -112,6 +122,13 @@
"traits": {
"smithy.api#documentation": "<p>The tags to be attached to the suite definition.</p>"
}
},
"clientToken": {
"target": "com.amazonaws.iotdeviceadvisor#ClientToken",
"traits": {
"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>",
"smithy.api#idempotencyToken": {}
}
}
},
"traits": {
Expand Down

0 comments on commit 3b3ce33

Please sign in to comment.