diff --git a/clients/client-iot-events-data/src/IoTEventsData.ts b/clients/client-iot-events-data/src/IoTEventsData.ts index 261e78125ff4..d5263d59007f 100644 --- a/clients/client-iot-events-data/src/IoTEventsData.ts +++ b/clients/client-iot-events-data/src/IoTEventsData.ts @@ -6,6 +6,11 @@ import { BatchAcknowledgeAlarmCommandInput, BatchAcknowledgeAlarmCommandOutput, } from "./commands/BatchAcknowledgeAlarmCommand"; +import { + BatchDeleteDetectorCommand, + BatchDeleteDetectorCommandInput, + BatchDeleteDetectorCommandOutput, +} from "./commands/BatchDeleteDetectorCommand"; import { BatchDisableAlarmCommand, BatchDisableAlarmCommandInput, @@ -95,6 +100,38 @@ export class IoTEventsData extends IoTEventsDataClient { } } + /** + *
Deletes one or more detectors that were created. When a detector is deleted, its state will be cleared and the detector will be removed from the list of detectors. The deleted detector will no longer appear if referenced in the ListDetectors API call.
+ */ + public batchDeleteDetector( + args: BatchDeleteDetectorCommandInput, + options?: __HttpHandlerOptions + ): PromiseDisables one or more alarms. The alarms change to the DISABLED
state after
* you disable them.
Deletes one or more detectors that were created. When a detector is deleted, its state will be cleared and the detector will be removed from the list of detectors. The deleted detector will no longer appear if referenced in the ListDetectors API call.
+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { IoTEventsDataClient, BatchDeleteDetectorCommand } from "@aws-sdk/client-iot-events-data"; // ES Modules import + * // const { IoTEventsDataClient, BatchDeleteDetectorCommand } = require("@aws-sdk/client-iot-events-data"); // CommonJS import + * const client = new IoTEventsDataClient(config); + * const command = new BatchDeleteDetectorCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link BatchDeleteDetectorCommandInput} for command's `input` shape. + * @see {@link BatchDeleteDetectorCommandOutput} for command's `response` shape. + * @see {@link IoTEventsDataClientResolvedConfig | config} for IoTEventsDataClient's `config` shape. + * + */ +export class BatchDeleteDetectorCommand extends $Command< + BatchDeleteDetectorCommandInput, + BatchDeleteDetectorCommandOutput, + IoTEventsDataClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: BatchDeleteDetectorCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStackInformation used to delete the detector model.
+ */ +export interface DeleteDetectorRequest { + /** + *The ID to assign to the DeleteDetectorRequest
. Each "messageId"
must be unique within each batch sent.
The name of the detector model that was used to create the detector instance.
+ */ + detectorModelName: string | undefined; + + /** + *The value of the key used to identify the detector.
+ */ + keyValue?: string; +} + +export namespace DeleteDetectorRequest { + /** + * @internal + */ + export const filterSensitiveLog = (obj: DeleteDetectorRequest): any => ({ + ...obj, + }); +} + +export interface BatchDeleteDetectorRequest { + /** + *The list of one or more detectors to be deleted.
+ */ + detectors: DeleteDetectorRequest[] | undefined; +} + +export namespace BatchDeleteDetectorRequest { + /** + * @internal + */ + export const filterSensitiveLog = (obj: BatchDeleteDetectorRequest): any => ({ + ...obj, + }); +} + +/** + *Contains error messages associated with the deletion request.
+ */ +export interface BatchDeleteDetectorErrorEntry { + /** + *The ID of the message that caused the error. (See the value of the "messageId"
in the detectors object of the DeleteDetectorRequest
.)
The error code.
+ */ + errorCode?: ErrorCode | string; + + /** + *A message that describes the error.
+ */ + errorMessage?: string; +} + +export namespace BatchDeleteDetectorErrorEntry { + /** + * @internal + */ + export const filterSensitiveLog = (obj: BatchDeleteDetectorErrorEntry): any => ({ + ...obj, + }); +} + +export interface BatchDeleteDetectorResponse { + /** + *A list of errors associated with the request, or an empty array ([]
) if there are no errors. Each error entry contains a messageId
that helps you identify the entry that failed.
Information used to disable the alarm.
*/ diff --git a/clients/client-iot-events-data/src/protocols/Aws_restJson1.ts b/clients/client-iot-events-data/src/protocols/Aws_restJson1.ts index 9217add09270..4a538fd060f2 100644 --- a/clients/client-iot-events-data/src/protocols/Aws_restJson1.ts +++ b/clients/client-iot-events-data/src/protocols/Aws_restJson1.ts @@ -20,6 +20,10 @@ import { BatchAcknowledgeAlarmCommandInput, BatchAcknowledgeAlarmCommandOutput, } from "../commands/BatchAcknowledgeAlarmCommand"; +import { + BatchDeleteDetectorCommandInput, + BatchDeleteDetectorCommandOutput, +} from "../commands/BatchDeleteDetectorCommand"; import { BatchDisableAlarmCommandInput, BatchDisableAlarmCommandOutput } from "../commands/BatchDisableAlarmCommand"; import { BatchEnableAlarmCommandInput, BatchEnableAlarmCommandOutput } from "../commands/BatchEnableAlarmCommand"; import { BatchPutMessageCommandInput, BatchPutMessageCommandOutput } from "../commands/BatchPutMessageCommand"; @@ -41,9 +45,11 @@ import { AlarmState, AlarmSummary, BatchAlarmActionErrorEntry, + BatchDeleteDetectorErrorEntry, BatchPutMessageErrorEntry, BatchUpdateDetectorErrorEntry, CustomerAction, + DeleteDetectorRequest, Detector, DetectorState, DetectorStateDefinition, @@ -105,6 +111,33 @@ export const serializeAws_restJson1BatchAcknowledgeAlarmCommand = async ( }); }; +export const serializeAws_restJson1BatchDeleteDetectorCommand = async ( + input: BatchDeleteDetectorCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detectors/delete"; + let body: any; + body = JSON.stringify({ + ...(input.detectors !== undefined && + input.detectors !== null && { + detectors: serializeAws_restJson1DeleteDetectorRequests(input.detectors, context), + }), + }); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + export const serializeAws_restJson1BatchDisableAlarmCommand = async ( input: BatchDisableAlarmCommandInput, context: __SerdeContext @@ -452,6 +485,62 @@ const deserializeAws_restJson1BatchAcknowledgeAlarmCommandError = async ( } }; +export const deserializeAws_restJson1BatchDeleteDetectorCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): PromiseContains error messages associated with one of the following requests:
\n\n BatchDisableAlarm\n
\n\n BatchEnableAlarm\n
\n\n BatchResetAlarm\n
\n\n BatchSnoozeAlarm\n
\nDeletes one or more detectors that were created. When a detector is deleted, its state will be cleared and the detector will be removed from the list of detectors. The deleted detector will no longer appear if referenced in the ListDetectors API call.
", + "smithy.api#http": { + "method": "POST", + "uri": "/detectors/delete", + "code": 200 + } + } + }, + "com.amazonaws.ioteventsdata#BatchDeleteDetectorErrorEntries": { + "type": "list", + "member": { + "target": "com.amazonaws.ioteventsdata#BatchDeleteDetectorErrorEntry" + } + }, + "com.amazonaws.ioteventsdata#BatchDeleteDetectorErrorEntry": { + "type": "structure", + "members": { + "messageId": { + "target": "com.amazonaws.ioteventsdata#MessageId", + "traits": { + "smithy.api#documentation": "The ID of the message that caused the error. (See the value of the \"messageId\"
in the detectors object of the DeleteDetectorRequest
.)
The error code.
" + } + }, + "errorMessage": { + "target": "com.amazonaws.ioteventsdata#ErrorMessage", + "traits": { + "smithy.api#documentation": "A message that describes the error.
" + } + } + }, + "traits": { + "smithy.api#documentation": "Contains error messages associated with the deletion request.
" + } + }, + "com.amazonaws.ioteventsdata#BatchDeleteDetectorRequest": { + "type": "structure", + "members": { + "detectors": { + "target": "com.amazonaws.ioteventsdata#DeleteDetectorRequests", + "traits": { + "smithy.api#documentation": "The list of one or more detectors to be deleted.
", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.ioteventsdata#BatchDeleteDetectorResponse": { + "type": "structure", + "members": { + "batchDeleteDetectorErrorEntries": { + "target": "com.amazonaws.ioteventsdata#BatchDeleteDetectorErrorEntries", + "traits": { + "smithy.api#documentation": "A list of errors associated with the request, or an empty array ([]
) if there are no errors. Each error entry contains a messageId
that helps you identify the entry that failed.
The ID to assign to the DeleteDetectorRequest
. Each \"messageId\"
must be unique within each batch sent.
The name of the detector model that was used to create the detector instance.
", + "smithy.api#required": {} + } + }, + "keyValue": { + "target": "com.amazonaws.ioteventsdata#KeyValue", + "traits": { + "smithy.api#documentation": "The value of the key used to identify the detector.
" + } + } + }, + "traits": { + "smithy.api#documentation": "Information used to delete the detector model.
" + } + }, + "com.amazonaws.ioteventsdata#DeleteDetectorRequests": { + "type": "list", + "member": { + "target": "com.amazonaws.ioteventsdata#DeleteDetectorRequest" + }, + "traits": { + "smithy.api#length": { + "min": 1 + } + } + }, "com.amazonaws.ioteventsdata#DescribeAlarm": { "type": "operation", "input": { @@ -1397,6 +1522,9 @@ { "target": "com.amazonaws.ioteventsdata#BatchAcknowledgeAlarm" }, + { + "target": "com.amazonaws.ioteventsdata#BatchDeleteDetector" + }, { "target": "com.amazonaws.ioteventsdata#BatchDisableAlarm" },