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).
*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.
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.
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 +): PromiseThe 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.
The time to live (TTL) parameter for the GetCommandExecution
API.
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.
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.
\nYou 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.
List all command executions.
\nYou 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.
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.
For more information about considerations for using this API, see\n List\n command executions in your account (CLI).
\n