From 870940385a30e46e44a3a975e513a4eded041cd3 Mon Sep 17 00:00:00 2001 From: awstools Date: Wed, 18 Dec 2024 19:12:49 +0000 Subject: [PATCH] feat(client-iot): Release connectivity status query API which is a dedicated high throughput(TPS) API to query a specific device's most recent connectivity state and metadata. --- clients/client-iot/README.md | 8 + clients/client-iot/src/IoT.ts | 23 ++ clients/client-iot/src/IoTClient.ts | 6 + .../GetThingConnectivityDataCommand.ts | 121 +++++++++ .../commands/ListCommandExecutionsCommand.ts | 23 +- ...etectMitigationActionsExecutionsCommand.ts | 6 +- clients/client-iot/src/commands/index.ts | 1 + clients/client-iot/src/models/models_0.ts | 5 +- clients/client-iot/src/models/models_1.ts | 247 ++++++------------ clients/client-iot/src/models/models_2.ts | 160 +++++++++++- .../client-iot/src/protocols/Aws_restJson1.ts | 46 +++- codegen/sdk-codegen/aws-models/iot.json | 199 +++++++++++++- 12 files changed, 670 insertions(+), 175 deletions(-) create mode 100644 clients/client-iot/src/commands/GetThingConnectivityDataCommand.ts diff --git a/clients/client-iot/README.md b/clients/client-iot/README.md index 82c59778fe87..f036b2bae2d3 100644 --- a/clients/client-iot/README.md +++ b/clients/client-iot/README.md @@ -1378,6 +1378,14 @@ GetStatistics [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/iot/command/GetStatisticsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-iot/Interface/GetStatisticsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-iot/Interface/GetStatisticsCommandOutput/) + +
+ +GetThingConnectivityData + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/iot/command/GetThingConnectivityDataCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-iot/Interface/GetThingConnectivityDataCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-iot/Interface/GetThingConnectivityDataCommandOutput/) +
diff --git a/clients/client-iot/src/IoT.ts b/clients/client-iot/src/IoT.ts index 8b181cd52b37..60b87503d50b 100644 --- a/clients/client-iot/src/IoT.ts +++ b/clients/client-iot/src/IoT.ts @@ -691,6 +691,11 @@ import { GetStatisticsCommandInput, GetStatisticsCommandOutput, } from "./commands/GetStatisticsCommand"; +import { + GetThingConnectivityDataCommand, + GetThingConnectivityDataCommandInput, + GetThingConnectivityDataCommandOutput, +} from "./commands/GetThingConnectivityDataCommand"; import { GetTopicRuleCommand, GetTopicRuleCommandInput, @@ -1427,6 +1432,7 @@ const commands = { GetPolicyVersionCommand, GetRegistrationCodeCommand, GetStatisticsCommand, + GetThingConnectivityDataCommand, GetTopicRuleCommand, GetTopicRuleDestinationCommand, GetV2LoggingOptionsCommand, @@ -3849,6 +3855,23 @@ export interface IoT { cb: (err: any, data?: GetStatisticsCommandOutput) => void ): void; + /** + * @see {@link GetThingConnectivityDataCommand} + */ + getThingConnectivityData( + args: GetThingConnectivityDataCommandInput, + options?: __HttpHandlerOptions + ): Promise; + getThingConnectivityData( + args: GetThingConnectivityDataCommandInput, + cb: (err: any, data?: GetThingConnectivityDataCommandOutput) => void + ): void; + getThingConnectivityData( + args: GetThingConnectivityDataCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GetThingConnectivityDataCommandOutput) => void + ): void; + /** * @see {@link GetTopicRuleCommand} */ diff --git a/clients/client-iot/src/IoTClient.ts b/clients/client-iot/src/IoTClient.ts index 80e1bae507bd..cc5b499bad3e 100644 --- a/clients/client-iot/src/IoTClient.ts +++ b/clients/client-iot/src/IoTClient.ts @@ -441,6 +441,10 @@ import { GetRegistrationCodeCommandOutput, } from "./commands/GetRegistrationCodeCommand"; import { GetStatisticsCommandInput, GetStatisticsCommandOutput } from "./commands/GetStatisticsCommand"; +import { + GetThingConnectivityDataCommandInput, + GetThingConnectivityDataCommandOutput, +} from "./commands/GetThingConnectivityDataCommand"; import { GetTopicRuleCommandInput, GetTopicRuleCommandOutput } from "./commands/GetTopicRuleCommand"; import { GetTopicRuleDestinationCommandInput, @@ -956,6 +960,7 @@ export type ServiceInputTypes = | GetPolicyVersionCommandInput | GetRegistrationCodeCommandInput | GetStatisticsCommandInput + | GetThingConnectivityDataCommandInput | GetTopicRuleCommandInput | GetTopicRuleDestinationCommandInput | GetV2LoggingOptionsCommandInput @@ -1230,6 +1235,7 @@ export type ServiceOutputTypes = | GetPolicyVersionCommandOutput | GetRegistrationCodeCommandOutput | GetStatisticsCommandOutput + | GetThingConnectivityDataCommandOutput | GetTopicRuleCommandOutput | GetTopicRuleDestinationCommandOutput | GetV2LoggingOptionsCommandOutput diff --git a/clients/client-iot/src/commands/GetThingConnectivityDataCommand.ts b/clients/client-iot/src/commands/GetThingConnectivityDataCommand.ts new file mode 100644 index 000000000000..37952d2c17cc --- /dev/null +++ b/clients/client-iot/src/commands/GetThingConnectivityDataCommand.ts @@ -0,0 +1,121 @@ +// smithy-typescript generated code +import { getEndpointPlugin } from "@smithy/middleware-endpoint"; +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { commonParams } from "../endpoint/EndpointParameters"; +import { IoTClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTClient"; +import { + GetThingConnectivityDataRequest, + GetThingConnectivityDataRequestFilterSensitiveLog, + GetThingConnectivityDataResponse, + GetThingConnectivityDataResponseFilterSensitiveLog, +} from "../models/models_1"; +import { de_GetThingConnectivityDataCommand, se_GetThingConnectivityDataCommand } from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link GetThingConnectivityDataCommand}. + */ +export interface GetThingConnectivityDataCommandInput extends GetThingConnectivityDataRequest {} +/** + * @public + * + * The output of {@link GetThingConnectivityDataCommand}. + */ +export interface GetThingConnectivityDataCommandOutput extends GetThingConnectivityDataResponse, __MetadataBearer {} + +/** + *

Retrieves the live connectivity status per device.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { IoTClient, GetThingConnectivityDataCommand } from "@aws-sdk/client-iot"; // ES Modules import + * // const { IoTClient, GetThingConnectivityDataCommand } = require("@aws-sdk/client-iot"); // CommonJS import + * const client = new IoTClient(config); + * const input = { // GetThingConnectivityDataRequest + * thingName: "STRING_VALUE", // required + * }; + * const command = new GetThingConnectivityDataCommand(input); + * const response = await client.send(command); + * // { // GetThingConnectivityDataResponse + * // thingName: "STRING_VALUE", + * // connected: true || false, + * // timestamp: new Date("TIMESTAMP"), + * // disconnectReason: "AUTH_ERROR" || "CLIENT_INITIATED_DISCONNECT" || "CLIENT_ERROR" || "CONNECTION_LOST" || "DUPLICATE_CLIENTID" || "FORBIDDEN_ACCESS" || "MQTT_KEEP_ALIVE_TIMEOUT" || "SERVER_ERROR" || "SERVER_INITIATED_DISCONNECT" || "THROTTLED" || "WEBSOCKET_TTL_EXPIRATION" || "CUSTOMAUTH_TTL_EXPIRATION" || "UNKNOWN" || "NONE", + * // }; + * + * ``` + * + * @param GetThingConnectivityDataCommandInput - {@link GetThingConnectivityDataCommandInput} + * @returns {@link GetThingConnectivityDataCommandOutput} + * @see {@link GetThingConnectivityDataCommandInput} for command's `input` shape. + * @see {@link GetThingConnectivityDataCommandOutput} for command's `response` shape. + * @see {@link IoTClientResolvedConfig | config} for IoTClient's `config` shape. + * + * @throws {@link IndexNotReadyException} (client fault) + *

The index is not ready.

+ * + * @throws {@link InternalFailureException} (server fault) + *

An unexpected error has occurred.

+ * + * @throws {@link InvalidRequestException} (client fault) + *

The request is not valid.

+ * + * @throws {@link ResourceNotFoundException} (client fault) + *

The specified resource does not exist.

+ * + * @throws {@link ServiceUnavailableException} (server fault) + *

The service is temporarily unavailable.

+ * + * @throws {@link ThrottlingException} (client fault) + *

The rate exceeds the limit.

+ * + * @throws {@link UnauthorizedException} (client fault) + *

You are not authorized to perform this operation.

+ * + * @throws {@link IoTServiceException} + *

Base exception class for all service exceptions from IoT service.

+ * + * @public + */ +export class GetThingConnectivityDataCommand extends $Command + .classBuilder< + GetThingConnectivityDataCommandInput, + GetThingConnectivityDataCommandOutput, + IoTClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep(commonParams) + .m(function (this: any, Command: any, cs: any, config: IoTClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AWSIotService", "GetThingConnectivityData", {}) + .n("IoTClient", "GetThingConnectivityDataCommand") + .f(GetThingConnectivityDataRequestFilterSensitiveLog, GetThingConnectivityDataResponseFilterSensitiveLog) + .ser(se_GetThingConnectivityDataCommand) + .de(de_GetThingConnectivityDataCommand) + .build() { + /** @internal type navigation helper, not in runtime. */ + protected declare static __types: { + api: { + input: GetThingConnectivityDataRequest; + output: GetThingConnectivityDataResponse; + }; + sdk: { + input: GetThingConnectivityDataCommandInput; + output: GetThingConnectivityDataCommandOutput; + }; + }; +} diff --git a/clients/client-iot/src/commands/ListCommandExecutionsCommand.ts b/clients/client-iot/src/commands/ListCommandExecutionsCommand.ts index ff59414e684a..41b4ebc0355e 100644 --- a/clients/client-iot/src/commands/ListCommandExecutionsCommand.ts +++ b/clients/client-iot/src/commands/ListCommandExecutionsCommand.ts @@ -30,11 +30,24 @@ export interface ListCommandExecutionsCommandOutput extends ListCommandExecution /** *

List all command executions.

* - *

You must provide only the - * startedTimeFilter or the completedTimeFilter information. If you - * provide both time filters, the API will generate an error. - * You can use this information to find command executions that started within - * a specific timeframe.

+ *
    + *
  • + *

    You must provide only the startedTimeFilter or + * the completedTimeFilter information. If you provide + * both time filters, the API will generate an error. You can use + * this information to retrieve a list of command executions + * within a specific timeframe.

    + *
  • + *
  • + *

    You must provide only the commandArn or + * the thingArn information depending on whether you want + * to list executions for a specific command or an IoT thing. If you provide + * both fields, the API will generate an error.

    + *
  • + *
+ *

For more information about considerations for using this API, see + * List + * command executions in your account (CLI).

*
* @example * Use a bare-bones client and the command you need to make an API call. diff --git a/clients/client-iot/src/commands/ListDetectMitigationActionsExecutionsCommand.ts b/clients/client-iot/src/commands/ListDetectMitigationActionsExecutionsCommand.ts index 05b4b451d3dc..472bb49a48d3 100644 --- a/clients/client-iot/src/commands/ListDetectMitigationActionsExecutionsCommand.ts +++ b/clients/client-iot/src/commands/ListDetectMitigationActionsExecutionsCommand.ts @@ -6,8 +6,10 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types"; import { commonParams } from "../endpoint/EndpointParameters"; import { IoTClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTClient"; -import { ListDetectMitigationActionsExecutionsRequest } from "../models/models_1"; -import { ListDetectMitigationActionsExecutionsResponse } from "../models/models_2"; +import { + ListDetectMitigationActionsExecutionsRequest, + ListDetectMitigationActionsExecutionsResponse, +} from "../models/models_2"; import { de_ListDetectMitigationActionsExecutionsCommand, se_ListDetectMitigationActionsExecutionsCommand, diff --git a/clients/client-iot/src/commands/index.ts b/clients/client-iot/src/commands/index.ts index 0b65af83c188..79598f8cbdbb 100644 --- a/clients/client-iot/src/commands/index.ts +++ b/clients/client-iot/src/commands/index.ts @@ -144,6 +144,7 @@ export * from "./GetPolicyCommand"; export * from "./GetPolicyVersionCommand"; export * from "./GetRegistrationCodeCommand"; export * from "./GetStatisticsCommand"; +export * from "./GetThingConnectivityDataCommand"; export * from "./GetTopicRuleCommand"; export * from "./GetTopicRuleDestinationCommand"; export * from "./GetV2LoggingOptionsCommand"; diff --git a/clients/client-iot/src/models/models_0.ts b/clients/client-iot/src/models/models_0.ts index 3467d7d57bf2..a8028d136cf7 100644 --- a/clients/client-iot/src/models/models_0.ts +++ b/clients/client-iot/src/models/models_0.ts @@ -4522,7 +4522,10 @@ export interface CreateCommandRequest { mandatoryParameters?: CommandParameter[] | undefined; /** - *

The IAM role that allows access to create the command.

+ *

The IAM role that you must provide when using the AWS-IoT-FleetWise namespace. + * The role grants IoT Device Management the permission to access IoT FleetWise resources + * for generating the payload for the command. This field is not required when you use the + * AWS-IoT namespace.

* @public */ roleArn?: string | undefined; diff --git a/clients/client-iot/src/models/models_1.ts b/clients/client-iot/src/models/models_1.ts index 7a2aa7a3b723..b6cca56765bc 100644 --- a/clients/client-iot/src/models/models_1.ts +++ b/clients/client-iot/src/models/models_1.ts @@ -4763,7 +4763,8 @@ export interface GetCommandResponse { payload?: CommandPayload | undefined; /** - *

The IAM role that allows access to retrieve information about the command.

+ *

The IAM role that you provided when creating the command with AWS-IoT-FleetWise + * as the namespace.

* @public */ roleArn?: string | undefined; @@ -4989,7 +4990,8 @@ export interface GetCommandExecutionResponse { completedAt?: Date | undefined; /** - *

The time to live (TTL) parameter for the GetCommandExecution API.

+ *

The time to live (TTL) parameter that indicates the duration for which executions will + * be retained in your account. The default value is six months.

* @public */ timeToLive?: Date | undefined; @@ -6104,6 +6106,72 @@ export interface GetStatisticsResponse { statistics?: Statistics | undefined; } +/** + * @public + */ +export interface GetThingConnectivityDataRequest { + /** + *

The name of your IoT thing.

+ * @public + */ + thingName: string | undefined; +} + +/** + * @public + * @enum + */ +export const DisconnectReasonValue = { + AUTH_ERROR: "AUTH_ERROR", + CLIENT_ERROR: "CLIENT_ERROR", + CLIENT_INITIATED_DISCONNECT: "CLIENT_INITIATED_DISCONNECT", + CONNECTION_LOST: "CONNECTION_LOST", + CUSTOMAUTH_TTL_EXPIRATION: "CUSTOMAUTH_TTL_EXPIRATION", + DUPLICATE_CLIENTID: "DUPLICATE_CLIENTID", + FORBIDDEN_ACCESS: "FORBIDDEN_ACCESS", + MQTT_KEEP_ALIVE_TIMEOUT: "MQTT_KEEP_ALIVE_TIMEOUT", + NONE: "NONE", + SERVER_ERROR: "SERVER_ERROR", + SERVER_INITIATED_DISCONNECT: "SERVER_INITIATED_DISCONNECT", + THROTTLED: "THROTTLED", + UNKNOWN: "UNKNOWN", + WEBSOCKET_TTL_EXPIRATION: "WEBSOCKET_TTL_EXPIRATION", +} as const; + +/** + * @public + */ +export type DisconnectReasonValue = (typeof DisconnectReasonValue)[keyof typeof DisconnectReasonValue]; + +/** + * @public + */ +export interface GetThingConnectivityDataResponse { + /** + *

The name of your IoT thing.

+ * @public + */ + thingName?: string | undefined; + + /** + *

A Boolean that indicates the connectivity status.

+ * @public + */ + connected?: boolean | undefined; + + /** + *

The timestamp of when the event occurred.

+ * @public + */ + timestamp?: Date | undefined; + + /** + *

The reason why the client is disconnecting.

+ * @public + */ + disconnectReason?: DisconnectReasonValue | undefined; +} + /** *

The input for the GetTopicRule operation.

* @public @@ -7400,165 +7468,6 @@ export interface ListCustomMetricsResponse { nextToken?: string | undefined; } -/** - * @public - */ -export interface ListDetectMitigationActionsExecutionsRequest { - /** - *

- * The unique identifier of the task. - *

- * @public - */ - taskId?: string | undefined; - - /** - *

- * The unique identifier of the violation. - *

- * @public - */ - violationId?: string | undefined; - - /** - *

- * The name of the thing whose mitigation actions are listed. - *

- * @public - */ - thingName?: string | undefined; - - /** - *

- * A filter to limit results to those found after the specified time. You must - * specify either the startTime and endTime or the taskId, but not both. - *

- * @public - */ - startTime?: Date | undefined; - - /** - *

- * The end of the time period for which ML Detect mitigation actions executions are returned. - *

- * @public - */ - endTime?: Date | undefined; - - /** - *

- * The maximum number of results to return at one time. The default is 25. - *

- * @public - */ - maxResults?: number | undefined; - - /** - *

- * The token for the next set of results. - *

- * @public - */ - nextToken?: string | undefined; -} - -/** - * @public - * @enum - */ -export const DetectMitigationActionExecutionStatus = { - FAILED: "FAILED", - IN_PROGRESS: "IN_PROGRESS", - SKIPPED: "SKIPPED", - SUCCESSFUL: "SUCCESSFUL", -} as const; - -/** - * @public - */ -export type DetectMitigationActionExecutionStatus = - (typeof DetectMitigationActionExecutionStatus)[keyof typeof DetectMitigationActionExecutionStatus]; - -/** - *

- * Describes which mitigation actions should be executed. - *

- * @public - */ -export interface DetectMitigationActionExecution { - /** - *

- * The unique identifier of the task. - *

- * @public - */ - taskId?: string | undefined; - - /** - *

- * The unique identifier of the violation. - *

- * @public - */ - violationId?: string | undefined; - - /** - *

- * The friendly name that uniquely identifies the mitigation action. - *

- * @public - */ - actionName?: string | undefined; - - /** - *

- * The name of the thing. - *

- * @public - */ - thingName?: string | undefined; - - /** - *

- * The date a mitigation action was started. - *

- * @public - */ - executionStartDate?: Date | undefined; - - /** - *

- * The date a mitigation action ended. - *

- * @public - */ - executionEndDate?: Date | undefined; - - /** - *

- * The status of a mitigation action. - *

- * @public - */ - status?: DetectMitigationActionExecutionStatus | undefined; - - /** - *

- * The error code of a mitigation action. - *

- * @public - */ - errorCode?: string | undefined; - - /** - *

- * The message of a mitigation action. - *

- * @public - */ - message?: string | undefined; -} - /** * @internal */ @@ -7576,3 +7485,19 @@ export const GetPackageVersionResponseFilterSensitiveLog = (obj: GetPackageVersi ...(obj.attributes && { attributes: SENSITIVE_STRING }), ...(obj.recipe && { recipe: SENSITIVE_STRING }), }); + +/** + * @internal + */ +export const GetThingConnectivityDataRequestFilterSensitiveLog = (obj: GetThingConnectivityDataRequest): any => ({ + ...obj, + ...(obj.thingName && { thingName: SENSITIVE_STRING }), +}); + +/** + * @internal + */ +export const GetThingConnectivityDataResponseFilterSensitiveLog = (obj: GetThingConnectivityDataResponse): any => ({ + ...obj, + ...(obj.thingName && { thingName: SENSITIVE_STRING }), +}); diff --git a/clients/client-iot/src/models/models_2.ts b/clients/client-iot/src/models/models_2.ts index 579d89d0d526..2ca501a291af 100644 --- a/clients/client-iot/src/models/models_2.ts +++ b/clients/client-iot/src/models/models_2.ts @@ -68,7 +68,6 @@ import { CertificateMode, CertificateStatus, Configuration, - DetectMitigationActionExecution, DetectMitigationActionsTaskSummary, DetectMitigationActionsTaskTarget, DomainConfigurationStatus, @@ -87,6 +86,165 @@ import { ViolationEventOccurrenceRange, } from "./models_1"; +/** + * @public + */ +export interface ListDetectMitigationActionsExecutionsRequest { + /** + *

+ * The unique identifier of the task. + *

+ * @public + */ + taskId?: string | undefined; + + /** + *

+ * The unique identifier of the violation. + *

+ * @public + */ + violationId?: string | undefined; + + /** + *

+ * The name of the thing whose mitigation actions are listed. + *

+ * @public + */ + thingName?: string | undefined; + + /** + *

+ * A filter to limit results to those found after the specified time. You must + * specify either the startTime and endTime or the taskId, but not both. + *

+ * @public + */ + startTime?: Date | undefined; + + /** + *

+ * The end of the time period for which ML Detect mitigation actions executions are returned. + *

+ * @public + */ + endTime?: Date | undefined; + + /** + *

+ * The maximum number of results to return at one time. The default is 25. + *

+ * @public + */ + maxResults?: number | undefined; + + /** + *

+ * The token for the next set of results. + *

+ * @public + */ + nextToken?: string | undefined; +} + +/** + * @public + * @enum + */ +export const DetectMitigationActionExecutionStatus = { + FAILED: "FAILED", + IN_PROGRESS: "IN_PROGRESS", + SKIPPED: "SKIPPED", + SUCCESSFUL: "SUCCESSFUL", +} as const; + +/** + * @public + */ +export type DetectMitigationActionExecutionStatus = + (typeof DetectMitigationActionExecutionStatus)[keyof typeof DetectMitigationActionExecutionStatus]; + +/** + *

+ * Describes which mitigation actions should be executed. + *

+ * @public + */ +export interface DetectMitigationActionExecution { + /** + *

+ * The unique identifier of the task. + *

+ * @public + */ + taskId?: string | undefined; + + /** + *

+ * The unique identifier of the violation. + *

+ * @public + */ + violationId?: string | undefined; + + /** + *

+ * The friendly name that uniquely identifies the mitigation action. + *

+ * @public + */ + actionName?: string | undefined; + + /** + *

+ * The name of the thing. + *

+ * @public + */ + thingName?: string | undefined; + + /** + *

+ * The date a mitigation action was started. + *

+ * @public + */ + executionStartDate?: Date | undefined; + + /** + *

+ * The date a mitigation action ended. + *

+ * @public + */ + executionEndDate?: Date | undefined; + + /** + *

+ * The status of a mitigation action. + *

+ * @public + */ + status?: DetectMitigationActionExecutionStatus | undefined; + + /** + *

+ * The error code of a mitigation action. + *

+ * @public + */ + errorCode?: string | undefined; + + /** + *

+ * The message of a mitigation action. + *

+ * @public + */ + message?: string | undefined; +} + /** * @public */ diff --git a/clients/client-iot/src/protocols/Aws_restJson1.ts b/clients/client-iot/src/protocols/Aws_restJson1.ts index 16bf3632aacb..dd1c27cfa2c3 100644 --- a/clients/client-iot/src/protocols/Aws_restJson1.ts +++ b/clients/client-iot/src/protocols/Aws_restJson1.ts @@ -413,6 +413,10 @@ import { GetRegistrationCodeCommandOutput, } from "../commands/GetRegistrationCodeCommand"; import { GetStatisticsCommandInput, GetStatisticsCommandOutput } from "../commands/GetStatisticsCommand"; +import { + GetThingConnectivityDataCommandInput, + GetThingConnectivityDataCommandOutput, +} from "../commands/GetThingConnectivityDataCommand"; import { GetTopicRuleCommandInput, GetTopicRuleCommandOutput } from "../commands/GetTopicRuleCommand"; import { GetTopicRuleDestinationCommandInput, @@ -934,7 +938,6 @@ import { CommandSummary, Configuration, DeleteConflictException, - DetectMitigationActionExecution, DetectMitigationActionsTaskSummary, DetectMitigationActionsTaskTarget, EventType, @@ -964,6 +967,7 @@ import { } from "../models/models_1"; import { CertificateConflictException, + DetectMitigationActionExecution, HttpContext, InvalidResponseException, JobExecutionSummary, @@ -3902,6 +3906,22 @@ export const se_GetStatisticsCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1GetThingConnectivityDataCommand + */ +export const se_GetThingConnectivityDataCommand = async ( + input: GetThingConnectivityDataCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = {}; + b.bp("/things/{thingName}/connectivity-data"); + b.p("thingName", () => input.thingName!, "{thingName}", false); + let body: any; + b.m("POST").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1GetTopicRuleCommand */ @@ -9810,6 +9830,30 @@ export const de_GetStatisticsCommand = async ( return contents; }; +/** + * deserializeAws_restJson1GetThingConnectivityDataCommand + */ +export const de_GetThingConnectivityDataCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + connected: __expectBoolean, + disconnectReason: __expectString, + thingName: __expectString, + timestamp: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + }); + Object.assign(contents, doc); + return contents; +}; + /** * deserializeAws_restJson1GetTopicRuleCommand */ diff --git a/codegen/sdk-codegen/aws-models/iot.json b/codegen/sdk-codegen/aws-models/iot.json index ffd8b8188653..fce339708e3d 100644 --- a/codegen/sdk-codegen/aws-models/iot.json +++ b/codegen/sdk-codegen/aws-models/iot.json @@ -468,6 +468,9 @@ { "target": "com.amazonaws.iot#GetStatistics" }, + { + "target": "com.amazonaws.iot#GetThingConnectivityData" + }, { "target": "com.amazonaws.iot#GetTopicRule" }, @@ -6890,6 +6893,17 @@ "smithy.api#pattern": "^[a-zA-Z0-9:.]+$" } }, + "com.amazonaws.iot#ConnectivityApiThingName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 128 + }, + "smithy.api#pattern": "^[a-zA-Z0-9:_-]+$", + "smithy.api#sensitive": {} + } + }, "com.amazonaws.iot#ConnectivityTimestamp": { "type": "long" }, @@ -7492,7 +7506,7 @@ "roleArn": { "target": "com.amazonaws.iot#RoleArn", "traits": { - "smithy.api#documentation": "

The IAM role that allows access to create the command.

" + "smithy.api#documentation": "

The IAM role that you must provide when using the AWS-IoT-FleetWise namespace.\n The role grants IoT Device Management the permission to access IoT FleetWise resources \n for generating the payload for the command. This field is not required when you use the\n AWS-IoT namespace.

" } }, "tags": { @@ -16802,6 +16816,95 @@ "com.amazonaws.iot#DisconnectReason": { "type": "string" }, + "com.amazonaws.iot#DisconnectReasonValue": { + "type": "enum", + "members": { + "AUTH_ERROR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "AUTH_ERROR" + } + }, + "CLIENT_INITIATED_DISCONNECT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "CLIENT_INITIATED_DISCONNECT" + } + }, + "CLIENT_ERROR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "CLIENT_ERROR" + } + }, + "CONNECTION_LOST": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "CONNECTION_LOST" + } + }, + "DUPLICATE_CLIENTID": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "DUPLICATE_CLIENTID" + } + }, + "FORBIDDEN_ACCESS": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "FORBIDDEN_ACCESS" + } + }, + "MQTT_KEEP_ALIVE_TIMEOUT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "MQTT_KEEP_ALIVE_TIMEOUT" + } + }, + "SERVER_ERROR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "SERVER_ERROR" + } + }, + "SERVER_INITIATED_DISCONNECT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "SERVER_INITIATED_DISCONNECT" + } + }, + "THROTTLED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "THROTTLED" + } + }, + "WEBSOCKET_TTL_EXPIRATION": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "WEBSOCKET_TTL_EXPIRATION" + } + }, + "CUSTOMAUTH_TTL_EXPIRATION": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "CUSTOMAUTH_TTL_EXPIRATION" + } + }, + "UNKNOWN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "UNKNOWN" + } + }, + "NONE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "NONE" + } + } + } + }, "com.amazonaws.iot#DisplayName": { "type": "string", "traits": { @@ -18414,7 +18517,7 @@ "timeToLive": { "target": "com.amazonaws.iot#DateType", "traits": { - "smithy.api#documentation": "

The time to live (TTL) parameter for the GetCommandExecution API.

" + "smithy.api#documentation": "

The time to live (TTL) parameter that indicates the duration for which executions will\n be retained in your account. The default value is six months.

" } } }, @@ -18486,7 +18589,7 @@ "roleArn": { "target": "com.amazonaws.iot#RoleArn", "traits": { - "smithy.api#documentation": "

The IAM role that allows access to retrieve information about the command.

" + "smithy.api#documentation": "

The IAM role that you provided when creating the command with AWS-IoT-FleetWise\n as the namespace.

" } }, "createdAt": { @@ -19605,6 +19708,94 @@ "smithy.api#output": {} } }, + "com.amazonaws.iot#GetThingConnectivityData": { + "type": "operation", + "input": { + "target": "com.amazonaws.iot#GetThingConnectivityDataRequest" + }, + "output": { + "target": "com.amazonaws.iot#GetThingConnectivityDataResponse" + }, + "errors": [ + { + "target": "com.amazonaws.iot#IndexNotReadyException" + }, + { + "target": "com.amazonaws.iot#InternalFailureException" + }, + { + "target": "com.amazonaws.iot#InvalidRequestException" + }, + { + "target": "com.amazonaws.iot#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.iot#ServiceUnavailableException" + }, + { + "target": "com.amazonaws.iot#ThrottlingException" + }, + { + "target": "com.amazonaws.iot#UnauthorizedException" + } + ], + "traits": { + "smithy.api#documentation": "

Retrieves the live connectivity status per device.

", + "smithy.api#http": { + "method": "POST", + "uri": "/things/{thingName}/connectivity-data", + "code": 200 + } + } + }, + "com.amazonaws.iot#GetThingConnectivityDataRequest": { + "type": "structure", + "members": { + "thingName": { + "target": "com.amazonaws.iot#ConnectivityApiThingName", + "traits": { + "smithy.api#documentation": "

The name of your IoT thing.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.iot#GetThingConnectivityDataResponse": { + "type": "structure", + "members": { + "thingName": { + "target": "com.amazonaws.iot#ConnectivityApiThingName", + "traits": { + "smithy.api#documentation": "

The name of your IoT thing.

" + } + }, + "connected": { + "target": "com.amazonaws.iot#Boolean", + "traits": { + "smithy.api#documentation": "

A Boolean that indicates the connectivity status.

" + } + }, + "timestamp": { + "target": "com.amazonaws.iot#Timestamp", + "traits": { + "smithy.api#documentation": "

The timestamp of when the event occurred.

" + } + }, + "disconnectReason": { + "target": "com.amazonaws.iot#DisconnectReasonValue", + "traits": { + "smithy.api#documentation": "

The reason why the client is disconnecting.

" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.iot#GetTopicRule": { "type": "operation", "input": { @@ -22712,7 +22903,7 @@ } ], "traits": { - "smithy.api#documentation": "

List all command executions.

\n \n

You must provide only the\n startedTimeFilter or the completedTimeFilter information. If you \n provide both time filters, the API will generate an error.\n You can use this information to find command executions that started within\n a specific timeframe.

\n
", + "smithy.api#documentation": "

List all command executions.

\n \n
    \n
  • \n

    You must provide only the startedTimeFilter or \n the completedTimeFilter information. If you provide \n both time filters, the API will generate an error. You can use \n this information to retrieve a list of command executions \n within a specific timeframe.

    \n
  • \n
  • \n

    You must provide only the commandArn or \n the thingArn information depending on whether you want\n to list executions for a specific command or an IoT thing. If you provide \n both fields, the API will generate an error.

    \n
  • \n
\n

For more information about considerations for using this API, see\n List\n command executions in your account (CLI).

\n
", "smithy.api#http": { "method": "POST", "uri": "/command-executions",