Skip to content

Commit

Permalink
feat(client-iotsitewise): This release adds 3 new batch data query AP…
Browse files Browse the repository at this point in the history
…Is : BatchGetAssetPropertyValue, BatchGetAssetPropertyValueHistory and BatchGetAssetPropertyAggregates
  • Loading branch information
awstools committed Apr 21, 2022
1 parent 7b8954d commit f07f481
Show file tree
Hide file tree
Showing 13 changed files with 3,390 additions and 302 deletions.
115 changes: 115 additions & 0 deletions clients/client-iotsitewise/src/IoTSiteWise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ import {
BatchDisassociateProjectAssetsCommandInput,
BatchDisassociateProjectAssetsCommandOutput,
} from "./commands/BatchDisassociateProjectAssetsCommand";
import {
BatchGetAssetPropertyAggregatesCommand,
BatchGetAssetPropertyAggregatesCommandInput,
BatchGetAssetPropertyAggregatesCommandOutput,
} from "./commands/BatchGetAssetPropertyAggregatesCommand";
import {
BatchGetAssetPropertyValueCommand,
BatchGetAssetPropertyValueCommandInput,
BatchGetAssetPropertyValueCommandOutput,
} from "./commands/BatchGetAssetPropertyValueCommand";
import {
BatchGetAssetPropertyValueHistoryCommand,
BatchGetAssetPropertyValueHistoryCommandInput,
BatchGetAssetPropertyValueHistoryCommandOutput,
} from "./commands/BatchGetAssetPropertyValueHistoryCommand";
import {
BatchPutAssetPropertyValueCommand,
BatchPutAssetPropertyValueCommandInput,
Expand Down Expand Up @@ -438,6 +453,106 @@ export class IoTSiteWise extends IoTSiteWiseClient {
}
}

/**
* <p>Gets aggregated values (for example, average, minimum, and maximum) for one or more asset properties.
* For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/query-industrial-data.html#aggregates">Querying
* aggregates</a> in the <i>IoT SiteWise User Guide</i>.</p>
*/
public batchGetAssetPropertyAggregates(
args: BatchGetAssetPropertyAggregatesCommandInput,
options?: __HttpHandlerOptions
): Promise<BatchGetAssetPropertyAggregatesCommandOutput>;
public batchGetAssetPropertyAggregates(
args: BatchGetAssetPropertyAggregatesCommandInput,
cb: (err: any, data?: BatchGetAssetPropertyAggregatesCommandOutput) => void
): void;
public batchGetAssetPropertyAggregates(
args: BatchGetAssetPropertyAggregatesCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: BatchGetAssetPropertyAggregatesCommandOutput) => void
): void;
public batchGetAssetPropertyAggregates(
args: BatchGetAssetPropertyAggregatesCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: BatchGetAssetPropertyAggregatesCommandOutput) => void),
cb?: (err: any, data?: BatchGetAssetPropertyAggregatesCommandOutput) => void
): Promise<BatchGetAssetPropertyAggregatesCommandOutput> | void {
const command = new BatchGetAssetPropertyAggregatesCommand(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>Gets the current value for one or more asset properties. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/query-industrial-data.html#current-values">Querying
* current values</a> in the <i>IoT SiteWise User Guide</i>.</p>
*/
public batchGetAssetPropertyValue(
args: BatchGetAssetPropertyValueCommandInput,
options?: __HttpHandlerOptions
): Promise<BatchGetAssetPropertyValueCommandOutput>;
public batchGetAssetPropertyValue(
args: BatchGetAssetPropertyValueCommandInput,
cb: (err: any, data?: BatchGetAssetPropertyValueCommandOutput) => void
): void;
public batchGetAssetPropertyValue(
args: BatchGetAssetPropertyValueCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: BatchGetAssetPropertyValueCommandOutput) => void
): void;
public batchGetAssetPropertyValue(
args: BatchGetAssetPropertyValueCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: BatchGetAssetPropertyValueCommandOutput) => void),
cb?: (err: any, data?: BatchGetAssetPropertyValueCommandOutput) => void
): Promise<BatchGetAssetPropertyValueCommandOutput> | void {
const command = new BatchGetAssetPropertyValueCommand(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>Gets the historical values for one or more asset properties. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/query-industrial-data.html#historical-values">Querying
* historical values</a> in the <i>IoT SiteWise User Guide</i>.</p>
*/
public batchGetAssetPropertyValueHistory(
args: BatchGetAssetPropertyValueHistoryCommandInput,
options?: __HttpHandlerOptions
): Promise<BatchGetAssetPropertyValueHistoryCommandOutput>;
public batchGetAssetPropertyValueHistory(
args: BatchGetAssetPropertyValueHistoryCommandInput,
cb: (err: any, data?: BatchGetAssetPropertyValueHistoryCommandOutput) => void
): void;
public batchGetAssetPropertyValueHistory(
args: BatchGetAssetPropertyValueHistoryCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: BatchGetAssetPropertyValueHistoryCommandOutput) => void
): void;
public batchGetAssetPropertyValueHistory(
args: BatchGetAssetPropertyValueHistoryCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: BatchGetAssetPropertyValueHistoryCommandOutput) => void),
cb?: (err: any, data?: BatchGetAssetPropertyValueHistoryCommandOutput) => void
): Promise<BatchGetAssetPropertyValueHistoryCommandOutput> | void {
const command = new BatchGetAssetPropertyValueHistoryCommand(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>Sends a list of asset property values to IoT SiteWise. Each value is a timestamp-quality-value
* (TQV) data point. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/ingest-api.html">Ingesting data using the API</a> in the
Expand Down
18 changes: 18 additions & 0 deletions clients/client-iotsitewise/src/IoTSiteWiseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ import {
BatchDisassociateProjectAssetsCommandInput,
BatchDisassociateProjectAssetsCommandOutput,
} from "./commands/BatchDisassociateProjectAssetsCommand";
import {
BatchGetAssetPropertyAggregatesCommandInput,
BatchGetAssetPropertyAggregatesCommandOutput,
} from "./commands/BatchGetAssetPropertyAggregatesCommand";
import {
BatchGetAssetPropertyValueCommandInput,
BatchGetAssetPropertyValueCommandOutput,
} from "./commands/BatchGetAssetPropertyValueCommand";
import {
BatchGetAssetPropertyValueHistoryCommandInput,
BatchGetAssetPropertyValueHistoryCommandOutput,
} from "./commands/BatchGetAssetPropertyValueHistoryCommand";
import {
BatchPutAssetPropertyValueCommandInput,
BatchPutAssetPropertyValueCommandOutput,
Expand Down Expand Up @@ -189,6 +201,9 @@ export type ServiceInputTypes =
| AssociateTimeSeriesToAssetPropertyCommandInput
| BatchAssociateProjectAssetsCommandInput
| BatchDisassociateProjectAssetsCommandInput
| BatchGetAssetPropertyAggregatesCommandInput
| BatchGetAssetPropertyValueCommandInput
| BatchGetAssetPropertyValueHistoryCommandInput
| BatchPutAssetPropertyValueCommandInput
| CreateAccessPolicyCommandInput
| CreateAssetCommandInput
Expand Down Expand Up @@ -256,6 +271,9 @@ export type ServiceOutputTypes =
| AssociateTimeSeriesToAssetPropertyCommandOutput
| BatchAssociateProjectAssetsCommandOutput
| BatchDisassociateProjectAssetsCommandOutput
| BatchGetAssetPropertyAggregatesCommandOutput
| BatchGetAssetPropertyValueCommandOutput
| BatchGetAssetPropertyValueHistoryCommandOutput
| BatchPutAssetPropertyValueCommandOutput
| CreateAccessPolicyCommandOutput
| CreateAssetCommandOutput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
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 { IoTSiteWiseClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTSiteWiseClient";
import { BatchGetAssetPropertyAggregatesRequest, BatchGetAssetPropertyAggregatesResponse } from "../models/models_0";
import {
deserializeAws_restJson1BatchGetAssetPropertyAggregatesCommand,
serializeAws_restJson1BatchGetAssetPropertyAggregatesCommand,
} from "../protocols/Aws_restJson1";

export interface BatchGetAssetPropertyAggregatesCommandInput extends BatchGetAssetPropertyAggregatesRequest {}
export interface BatchGetAssetPropertyAggregatesCommandOutput
extends BatchGetAssetPropertyAggregatesResponse,
__MetadataBearer {}

/**
* <p>Gets aggregated values (for example, average, minimum, and maximum) for one or more asset properties.
* For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/query-industrial-data.html#aggregates">Querying
* aggregates</a> in the <i>IoT SiteWise User Guide</i>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { IoTSiteWiseClient, BatchGetAssetPropertyAggregatesCommand } from "@aws-sdk/client-iotsitewise"; // ES Modules import
* // const { IoTSiteWiseClient, BatchGetAssetPropertyAggregatesCommand } = require("@aws-sdk/client-iotsitewise"); // CommonJS import
* const client = new IoTSiteWiseClient(config);
* const command = new BatchGetAssetPropertyAggregatesCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link BatchGetAssetPropertyAggregatesCommandInput} for command's `input` shape.
* @see {@link BatchGetAssetPropertyAggregatesCommandOutput} for command's `response` shape.
* @see {@link IoTSiteWiseClientResolvedConfig | config} for IoTSiteWiseClient's `config` shape.
*
*/
export class BatchGetAssetPropertyAggregatesCommand extends $Command<
BatchGetAssetPropertyAggregatesCommandInput,
BatchGetAssetPropertyAggregatesCommandOutput,
IoTSiteWiseClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

constructor(readonly input: BatchGetAssetPropertyAggregatesCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: IoTSiteWiseClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<BatchGetAssetPropertyAggregatesCommandInput, BatchGetAssetPropertyAggregatesCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

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

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

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

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

// Start section: command_body_extra
// End section: command_body_extra
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
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 { IoTSiteWiseClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTSiteWiseClient";
import { BatchGetAssetPropertyValueRequest, BatchGetAssetPropertyValueResponse } from "../models/models_0";
import {
deserializeAws_restJson1BatchGetAssetPropertyValueCommand,
serializeAws_restJson1BatchGetAssetPropertyValueCommand,
} from "../protocols/Aws_restJson1";

export interface BatchGetAssetPropertyValueCommandInput extends BatchGetAssetPropertyValueRequest {}
export interface BatchGetAssetPropertyValueCommandOutput extends BatchGetAssetPropertyValueResponse, __MetadataBearer {}

/**
* <p>Gets the current value for one or more asset properties. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/query-industrial-data.html#current-values">Querying
* current values</a> in the <i>IoT SiteWise User Guide</i>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { IoTSiteWiseClient, BatchGetAssetPropertyValueCommand } from "@aws-sdk/client-iotsitewise"; // ES Modules import
* // const { IoTSiteWiseClient, BatchGetAssetPropertyValueCommand } = require("@aws-sdk/client-iotsitewise"); // CommonJS import
* const client = new IoTSiteWiseClient(config);
* const command = new BatchGetAssetPropertyValueCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link BatchGetAssetPropertyValueCommandInput} for command's `input` shape.
* @see {@link BatchGetAssetPropertyValueCommandOutput} for command's `response` shape.
* @see {@link IoTSiteWiseClientResolvedConfig | config} for IoTSiteWiseClient's `config` shape.
*
*/
export class BatchGetAssetPropertyValueCommand extends $Command<
BatchGetAssetPropertyValueCommandInput,
BatchGetAssetPropertyValueCommandOutput,
IoTSiteWiseClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

constructor(readonly input: BatchGetAssetPropertyValueCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: IoTSiteWiseClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<BatchGetAssetPropertyValueCommandInput, BatchGetAssetPropertyValueCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

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

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

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

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

// Start section: command_body_extra
// End section: command_body_extra
}
Loading

0 comments on commit f07f481

Please sign in to comment.