@softchef/cdk-iot-device-management
Version:
IoT device management is composed of things, thing types, thing groups, jobs, files API services. The constructs can be used independently, that are based on full-managed service to create an API Gateway & Lambda function.
27 lines (26 loc) • 1.06 kB
JavaScript
import { constructStack } from "@aws-sdk/middleware-stack";
var Client = (function () {
function Client(config) {
this.middlewareStack = constructStack();
this.config = config;
}
Client.prototype.send = function (command, optionsOrCb, cb) {
var options = typeof optionsOrCb !== "function" ? optionsOrCb : undefined;
var callback = typeof optionsOrCb === "function" ? optionsOrCb : cb;
var handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
if (callback) {
handler(command)
.then(function (result) { return callback(null, result.output); }, function (err) { return callback(err); })
.catch(function () { });
}
else {
return handler(command).then(function (result) { return result.output; });
}
};
Client.prototype.destroy = function () {
if (this.config.requestHandler.destroy)
this.config.requestHandler.destroy();
};
return Client;
}());
export { Client };