Skip to content

Commit

Permalink
feat(client-iot-events-data): Introducing new API for deleting detect…
Browse files Browse the repository at this point in the history
…ors: BatchDeleteDetector.
  • Loading branch information
awstools committed May 18, 2022
1 parent 0f427f3 commit 4320da0
Show file tree
Hide file tree
Showing 7 changed files with 493 additions and 0 deletions.
37 changes: 37 additions & 0 deletions clients/client-iot-events-data/src/IoTEventsData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import {
BatchAcknowledgeAlarmCommandInput,
BatchAcknowledgeAlarmCommandOutput,
} from "./commands/BatchAcknowledgeAlarmCommand";
import {
BatchDeleteDetectorCommand,
BatchDeleteDetectorCommandInput,
BatchDeleteDetectorCommandOutput,
} from "./commands/BatchDeleteDetectorCommand";
import {
BatchDisableAlarmCommand,
BatchDisableAlarmCommandInput,
Expand Down Expand Up @@ -95,6 +100,38 @@ export class IoTEventsData extends IoTEventsDataClient {
}
}

/**
* <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>
*/
public batchDeleteDetector(
args: BatchDeleteDetectorCommandInput,
options?: __HttpHandlerOptions
): Promise<BatchDeleteDetectorCommandOutput>;
public batchDeleteDetector(
args: BatchDeleteDetectorCommandInput,
cb: (err: any, data?: BatchDeleteDetectorCommandOutput) => void
): void;
public batchDeleteDetector(
args: BatchDeleteDetectorCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: BatchDeleteDetectorCommandOutput) => void
): void;
public batchDeleteDetector(
args: BatchDeleteDetectorCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: BatchDeleteDetectorCommandOutput) => void),
cb?: (err: any, data?: BatchDeleteDetectorCommandOutput) => void
): Promise<BatchDeleteDetectorCommandOutput> | void {
const command = new BatchDeleteDetectorCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Disables one or more alarms. The alarms change to the <code>DISABLED</code> state after
* you disable them.</p>
Expand Down
6 changes: 6 additions & 0 deletions clients/client-iot-events-data/src/IoTEventsDataClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,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";
Expand All @@ -73,6 +77,7 @@ import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";

export type ServiceInputTypes =
| BatchAcknowledgeAlarmCommandInput
| BatchDeleteDetectorCommandInput
| BatchDisableAlarmCommandInput
| BatchEnableAlarmCommandInput
| BatchPutMessageCommandInput
Expand All @@ -86,6 +91,7 @@ export type ServiceInputTypes =

export type ServiceOutputTypes =
| BatchAcknowledgeAlarmCommandOutput
| BatchDeleteDetectorCommandOutput
| BatchDisableAlarmCommandOutput
| BatchEnableAlarmCommandOutput
| BatchPutMessageCommandOutput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// smithy-typescript generated code
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

import { IoTEventsDataClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTEventsDataClient";
import { BatchDeleteDetectorRequest, BatchDeleteDetectorResponse } from "../models/models_0";
import {
deserializeAws_restJson1BatchDeleteDetectorCommand,
serializeAws_restJson1BatchDeleteDetectorCommand,
} from "../protocols/Aws_restJson1";

export interface BatchDeleteDetectorCommandInput extends BatchDeleteDetectorRequest {}
export interface BatchDeleteDetectorCommandOutput extends BatchDeleteDetectorResponse, __MetadataBearer {}

/**
* <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>
* @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: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: IoTEventsDataClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<BatchDeleteDetectorCommandInput, BatchDeleteDetectorCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "IoTEventsDataClient";
const commandName = "BatchDeleteDetectorCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: BatchDeleteDetectorRequest.filterSensitiveLog,
outputFilterSensitiveLog: BatchDeleteDetectorResponse.filterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

private serialize(input: BatchDeleteDetectorCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_restJson1BatchDeleteDetectorCommand(input, context);
}

private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<BatchDeleteDetectorCommandOutput> {
return deserializeAws_restJson1BatchDeleteDetectorCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
1 change: 1 addition & 0 deletions clients/client-iot-events-data/src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// smithy-typescript generated code
export * from "./BatchAcknowledgeAlarmCommand";
export * from "./BatchDeleteDetectorCommand";
export * from "./BatchDisableAlarmCommand";
export * from "./BatchEnableAlarmCommand";
export * from "./BatchPutMessageCommand";
Expand Down
90 changes: 90 additions & 0 deletions clients/client-iot-events-data/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,96 @@ export class ThrottlingException extends __BaseException {
}
}

/**
* <p>Information used to delete the detector model.</p>
*/
export interface DeleteDetectorRequest {
/**
* <p>The ID to assign to the <code>DeleteDetectorRequest</code>. Each <code>"messageId"</code> must be unique within each batch sent.</p>
*/
messageId: string | undefined;

/**
* <p>The name of the detector model that was used to create the detector instance.</p>
*/
detectorModelName: string | undefined;

/**
* <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>
*/
keyValue?: string;
}

export namespace DeleteDetectorRequest {
/**
* @internal
*/
export const filterSensitiveLog = (obj: DeleteDetectorRequest): any => ({
...obj,
});
}

export interface BatchDeleteDetectorRequest {
/**
* <p>The list of one or more detectors to be deleted.</p>
*/
detectors: DeleteDetectorRequest[] | undefined;
}

export namespace BatchDeleteDetectorRequest {
/**
* @internal
*/
export const filterSensitiveLog = (obj: BatchDeleteDetectorRequest): any => ({
...obj,
});
}

/**
* <p>Contains error messages associated with the deletion request.</p>
*/
export interface BatchDeleteDetectorErrorEntry {
/**
* <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>
*/
messageId?: string;

/**
* <p>The error code.</p>
*/
errorCode?: ErrorCode | string;

/**
* <p>A message that describes the error.</p>
*/
errorMessage?: string;
}

export namespace BatchDeleteDetectorErrorEntry {
/**
* @internal
*/
export const filterSensitiveLog = (obj: BatchDeleteDetectorErrorEntry): any => ({
...obj,
});
}

export interface BatchDeleteDetectorResponse {
/**
* <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>
*/
batchDeleteDetectorErrorEntries?: BatchDeleteDetectorErrorEntry[];
}

export namespace BatchDeleteDetectorResponse {
/**
* @internal
*/
export const filterSensitiveLog = (obj: BatchDeleteDetectorResponse): any => ({
...obj,
});
}

/**
* <p>Information used to disable the alarm.</p>
*/
Expand Down
Loading

0 comments on commit 4320da0

Please sign in to comment.