DescribeAuditTaskCommand

Gets information about a Device Defender audit.

Requires permission to access the DescribeAuditTask  action.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { IoTClient, DescribeAuditTaskCommand } from "@aws-sdk/client-iot"; // ES Modules import
// const { IoTClient, DescribeAuditTaskCommand } = require("@aws-sdk/client-iot"); // CommonJS import
const client = new IoTClient(config);
const input = { // DescribeAuditTaskRequest
  taskId: "STRING_VALUE", // required
};
const command = new DescribeAuditTaskCommand(input);
const response = await client.send(command);
// { // DescribeAuditTaskResponse
//   taskStatus: "IN_PROGRESS" || "COMPLETED" || "FAILED" || "CANCELED",
//   taskType: "ON_DEMAND_AUDIT_TASK" || "SCHEDULED_AUDIT_TASK",
//   taskStartTime: new Date("TIMESTAMP"),
//   taskStatistics: { // TaskStatistics
//     totalChecks: Number("int"),
//     inProgressChecks: Number("int"),
//     waitingForDataCollectionChecks: Number("int"),
//     compliantChecks: Number("int"),
//     nonCompliantChecks: Number("int"),
//     failedChecks: Number("int"),
//     canceledChecks: Number("int"),
//   },
//   scheduledAuditName: "STRING_VALUE",
//   auditDetails: { // AuditDetails
//     "<keys>": { // AuditCheckDetails
//       checkRunStatus: "IN_PROGRESS" || "WAITING_FOR_DATA_COLLECTION" || "CANCELED" || "COMPLETED_COMPLIANT" || "COMPLETED_NON_COMPLIANT" || "FAILED",
//       checkCompliant: true || false,
//       totalResourcesCount: Number("long"),
//       nonCompliantResourcesCount: Number("long"),
//       suppressedNonCompliantResourcesCount: Number("long"),
//       errorCode: "STRING_VALUE",
//       message: "STRING_VALUE",
//     },
//   },
// };

DescribeAuditTaskCommand Input

See DescribeAuditTaskCommandInput for more details

Parameter
Type
Description
taskId
Required
string | undefined

The ID of the audit whose information you want to get.

DescribeAuditTaskCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
auditDetails
Record<string, AuditCheckDetails> | undefined

Detailed information about each check performed during this audit.

scheduledAuditName
string | undefined

The name of the scheduled audit (only if the audit was a scheduled audit).

taskStartTime
Date | undefined

The time the audit started.

taskStatistics
TaskStatistics | undefined

Statistical information about the audit.

taskStatus
AuditTaskStatus | undefined

The status of the audit: one of "IN_PROGRESS", "COMPLETED", "FAILED", or "CANCELED".

taskType
AuditTaskType | undefined

The type of audit: "ON_DEMAND_AUDIT_TASK" or "SCHEDULED_AUDIT_TASK".

Throws

Name
Fault
Details
InternalFailureException
server

An unexpected error has occurred.

InvalidRequestException
client

The request is not valid.

ResourceNotFoundException
client

The specified resource does not exist.

ThrottlingException
client

The rate exceeds the limit.

IoTServiceException
Base exception class for all service exceptions from IoT service.