Skip to content

Commit 4320da0

Browse files
author
awstools
committed
feat(client-iot-events-data): Introducing new API for deleting detectors: BatchDeleteDetector.
1 parent 0f427f3 commit 4320da0

File tree

7 files changed

+493
-0
lines changed

7 files changed

+493
-0
lines changed

Diff for: clients/client-iot-events-data/src/IoTEventsData.ts

+37
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import {
66
BatchAcknowledgeAlarmCommandInput,
77
BatchAcknowledgeAlarmCommandOutput,
88
} from "./commands/BatchAcknowledgeAlarmCommand";
9+
import {
10+
BatchDeleteDetectorCommand,
11+
BatchDeleteDetectorCommandInput,
12+
BatchDeleteDetectorCommandOutput,
13+
} from "./commands/BatchDeleteDetectorCommand";
914
import {
1015
BatchDisableAlarmCommand,
1116
BatchDisableAlarmCommandInput,
@@ -95,6 +100,38 @@ export class IoTEventsData extends IoTEventsDataClient {
95100
}
96101
}
97102

103+
/**
104+
* <p>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 <a href="https://docs.aws.amazon.com/iotevents/latest/apireference/API_iotevents-data_ListDetectors.html">ListDetectors</a> API call.</p>
105+
*/
106+
public batchDeleteDetector(
107+
args: BatchDeleteDetectorCommandInput,
108+
options?: __HttpHandlerOptions
109+
): Promise<BatchDeleteDetectorCommandOutput>;
110+
public batchDeleteDetector(
111+
args: BatchDeleteDetectorCommandInput,
112+
cb: (err: any, data?: BatchDeleteDetectorCommandOutput) => void
113+
): void;
114+
public batchDeleteDetector(
115+
args: BatchDeleteDetectorCommandInput,
116+
options: __HttpHandlerOptions,
117+
cb: (err: any, data?: BatchDeleteDetectorCommandOutput) => void
118+
): void;
119+
public batchDeleteDetector(
120+
args: BatchDeleteDetectorCommandInput,
121+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: BatchDeleteDetectorCommandOutput) => void),
122+
cb?: (err: any, data?: BatchDeleteDetectorCommandOutput) => void
123+
): Promise<BatchDeleteDetectorCommandOutput> | void {
124+
const command = new BatchDeleteDetectorCommand(args);
125+
if (typeof optionsOrCb === "function") {
126+
this.send(command, optionsOrCb);
127+
} else if (typeof cb === "function") {
128+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
129+
this.send(command, optionsOrCb || {}, cb);
130+
} else {
131+
return this.send(command, optionsOrCb);
132+
}
133+
}
134+
98135
/**
99136
* <p>Disables one or more alarms. The alarms change to the <code>DISABLED</code> state after
100137
* you disable them.</p>

Diff for: clients/client-iot-events-data/src/IoTEventsDataClient.ts

+6
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ import {
5656
BatchAcknowledgeAlarmCommandInput,
5757
BatchAcknowledgeAlarmCommandOutput,
5858
} from "./commands/BatchAcknowledgeAlarmCommand";
59+
import {
60+
BatchDeleteDetectorCommandInput,
61+
BatchDeleteDetectorCommandOutput,
62+
} from "./commands/BatchDeleteDetectorCommand";
5963
import { BatchDisableAlarmCommandInput, BatchDisableAlarmCommandOutput } from "./commands/BatchDisableAlarmCommand";
6064
import { BatchEnableAlarmCommandInput, BatchEnableAlarmCommandOutput } from "./commands/BatchEnableAlarmCommand";
6165
import { BatchPutMessageCommandInput, BatchPutMessageCommandOutput } from "./commands/BatchPutMessageCommand";
@@ -73,6 +77,7 @@ import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
7377

7478
export type ServiceInputTypes =
7579
| BatchAcknowledgeAlarmCommandInput
80+
| BatchDeleteDetectorCommandInput
7681
| BatchDisableAlarmCommandInput
7782
| BatchEnableAlarmCommandInput
7883
| BatchPutMessageCommandInput
@@ -86,6 +91,7 @@ export type ServiceInputTypes =
8691

8792
export type ServiceOutputTypes =
8893
| BatchAcknowledgeAlarmCommandOutput
94+
| BatchDeleteDetectorCommandOutput
8995
| BatchDisableAlarmCommandOutput
9096
| BatchEnableAlarmCommandOutput
9197
| BatchPutMessageCommandOutput
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// smithy-typescript generated code
2+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4+
import { Command as $Command } from "@aws-sdk/smithy-client";
5+
import {
6+
FinalizeHandlerArguments,
7+
Handler,
8+
HandlerExecutionContext,
9+
HttpHandlerOptions as __HttpHandlerOptions,
10+
MetadataBearer as __MetadataBearer,
11+
MiddlewareStack,
12+
SerdeContext as __SerdeContext,
13+
} from "@aws-sdk/types";
14+
15+
import { IoTEventsDataClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTEventsDataClient";
16+
import { BatchDeleteDetectorRequest, BatchDeleteDetectorResponse } from "../models/models_0";
17+
import {
18+
deserializeAws_restJson1BatchDeleteDetectorCommand,
19+
serializeAws_restJson1BatchDeleteDetectorCommand,
20+
} from "../protocols/Aws_restJson1";
21+
22+
export interface BatchDeleteDetectorCommandInput extends BatchDeleteDetectorRequest {}
23+
export interface BatchDeleteDetectorCommandOutput extends BatchDeleteDetectorResponse, __MetadataBearer {}
24+
25+
/**
26+
* <p>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 <a href="https://docs.aws.amazon.com/iotevents/latest/apireference/API_iotevents-data_ListDetectors.html">ListDetectors</a> API call.</p>
27+
* @example
28+
* Use a bare-bones client and the command you need to make an API call.
29+
* ```javascript
30+
* import { IoTEventsDataClient, BatchDeleteDetectorCommand } from "@aws-sdk/client-iot-events-data"; // ES Modules import
31+
* // const { IoTEventsDataClient, BatchDeleteDetectorCommand } = require("@aws-sdk/client-iot-events-data"); // CommonJS import
32+
* const client = new IoTEventsDataClient(config);
33+
* const command = new BatchDeleteDetectorCommand(input);
34+
* const response = await client.send(command);
35+
* ```
36+
*
37+
* @see {@link BatchDeleteDetectorCommandInput} for command's `input` shape.
38+
* @see {@link BatchDeleteDetectorCommandOutput} for command's `response` shape.
39+
* @see {@link IoTEventsDataClientResolvedConfig | config} for IoTEventsDataClient's `config` shape.
40+
*
41+
*/
42+
export class BatchDeleteDetectorCommand extends $Command<
43+
BatchDeleteDetectorCommandInput,
44+
BatchDeleteDetectorCommandOutput,
45+
IoTEventsDataClientResolvedConfig
46+
> {
47+
// Start section: command_properties
48+
// End section: command_properties
49+
50+
constructor(readonly input: BatchDeleteDetectorCommandInput) {
51+
// Start section: command_constructor
52+
super();
53+
// End section: command_constructor
54+
}
55+
56+
/**
57+
* @internal
58+
*/
59+
resolveMiddleware(
60+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
61+
configuration: IoTEventsDataClientResolvedConfig,
62+
options?: __HttpHandlerOptions
63+
): Handler<BatchDeleteDetectorCommandInput, BatchDeleteDetectorCommandOutput> {
64+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
65+
66+
const stack = clientStack.concat(this.middlewareStack);
67+
68+
const { logger } = configuration;
69+
const clientName = "IoTEventsDataClient";
70+
const commandName = "BatchDeleteDetectorCommand";
71+
const handlerExecutionContext: HandlerExecutionContext = {
72+
logger,
73+
clientName,
74+
commandName,
75+
inputFilterSensitiveLog: BatchDeleteDetectorRequest.filterSensitiveLog,
76+
outputFilterSensitiveLog: BatchDeleteDetectorResponse.filterSensitiveLog,
77+
};
78+
const { requestHandler } = configuration;
79+
return stack.resolve(
80+
(request: FinalizeHandlerArguments<any>) =>
81+
requestHandler.handle(request.request as __HttpRequest, options || {}),
82+
handlerExecutionContext
83+
);
84+
}
85+
86+
private serialize(input: BatchDeleteDetectorCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
87+
return serializeAws_restJson1BatchDeleteDetectorCommand(input, context);
88+
}
89+
90+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<BatchDeleteDetectorCommandOutput> {
91+
return deserializeAws_restJson1BatchDeleteDetectorCommand(output, context);
92+
}
93+
94+
// Start section: command_body_extra
95+
// End section: command_body_extra
96+
}

Diff for: clients/client-iot-events-data/src/commands/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// smithy-typescript generated code
22
export * from "./BatchAcknowledgeAlarmCommand";
3+
export * from "./BatchDeleteDetectorCommand";
34
export * from "./BatchDisableAlarmCommand";
45
export * from "./BatchEnableAlarmCommand";
56
export * from "./BatchPutMessageCommand";

Diff for: clients/client-iot-events-data/src/models/models_0.ts

+90
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,96 @@ export class ThrottlingException extends __BaseException {
705705
}
706706
}
707707

708+
/**
709+
* <p>Information used to delete the detector model.</p>
710+
*/
711+
export interface DeleteDetectorRequest {
712+
/**
713+
* <p>The ID to assign to the <code>DeleteDetectorRequest</code>. Each <code>"messageId"</code> must be unique within each batch sent.</p>
714+
*/
715+
messageId: string | undefined;
716+
717+
/**
718+
* <p>The name of the detector model that was used to create the detector instance.</p>
719+
*/
720+
detectorModelName: string | undefined;
721+
722+
/**
723+
* <p>The value of the <a href="https://docs.aws.amazon.com/iotevents/latest/apireference/API_CreateDetectorModel.html#iotevents-CreateDetectorModel-request-key">key</a> used to identify the detector. </p>
724+
*/
725+
keyValue?: string;
726+
}
727+
728+
export namespace DeleteDetectorRequest {
729+
/**
730+
* @internal
731+
*/
732+
export const filterSensitiveLog = (obj: DeleteDetectorRequest): any => ({
733+
...obj,
734+
});
735+
}
736+
737+
export interface BatchDeleteDetectorRequest {
738+
/**
739+
* <p>The list of one or more detectors to be deleted.</p>
740+
*/
741+
detectors: DeleteDetectorRequest[] | undefined;
742+
}
743+
744+
export namespace BatchDeleteDetectorRequest {
745+
/**
746+
* @internal
747+
*/
748+
export const filterSensitiveLog = (obj: BatchDeleteDetectorRequest): any => ({
749+
...obj,
750+
});
751+
}
752+
753+
/**
754+
* <p>Contains error messages associated with the deletion request.</p>
755+
*/
756+
export interface BatchDeleteDetectorErrorEntry {
757+
/**
758+
* <p>The ID of the message that caused the error. (See the value of the <code>"messageId"</code> in the <a href="https://docs.aws.amazon.com/iotevents/latest/apireference/API_iotevents-data_BatchDeleteDetector.html#iotevents-iotevents-data_BatchDeleteDetector-request-detectors">detectors</a> object of the <code>DeleteDetectorRequest</code>.)</p>
759+
*/
760+
messageId?: string;
761+
762+
/**
763+
* <p>The error code.</p>
764+
*/
765+
errorCode?: ErrorCode | string;
766+
767+
/**
768+
* <p>A message that describes the error.</p>
769+
*/
770+
errorMessage?: string;
771+
}
772+
773+
export namespace BatchDeleteDetectorErrorEntry {
774+
/**
775+
* @internal
776+
*/
777+
export const filterSensitiveLog = (obj: BatchDeleteDetectorErrorEntry): any => ({
778+
...obj,
779+
});
780+
}
781+
782+
export interface BatchDeleteDetectorResponse {
783+
/**
784+
* <p>A list of errors associated with the request, or an empty array (<code>[]</code>) if there are no errors. Each error entry contains a <code>messageId</code> that helps you identify the entry that failed.</p>
785+
*/
786+
batchDeleteDetectorErrorEntries?: BatchDeleteDetectorErrorEntry[];
787+
}
788+
789+
export namespace BatchDeleteDetectorResponse {
790+
/**
791+
* @internal
792+
*/
793+
export const filterSensitiveLog = (obj: BatchDeleteDetectorResponse): any => ({
794+
...obj,
795+
});
796+
}
797+
708798
/**
709799
* <p>Information used to disable the alarm.</p>
710800
*/

0 commit comments

Comments
 (0)