UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

159 lines 7.83 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Device = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages an IoTDA device within HuaweiCloud. * * > When accessing an IoTDA **standard** or **enterprise** edition instance, you need to specify the IoTDA service * endpoint in `provider` block. * You can login to the IoTDA console, choose the instance **Overview** and click **Access Details** * to view the HTTPS application access address. An example of the access address might be * **9bc34xxxxx.st1.iotda-app.ap-southeast-1.myhuaweicloud.com**, then you need to configure the * `provider` block as follows: * * ## Example Usage * ### Create a directly connected device and an indirectly connected device * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const spaceId = config.requireObject("spaceId"); * const productId = config.requireObject("productId"); * const secret = config.requireObject("secret"); * const device = new huaweicloud.iotda.Device("device", { * nodeId: "device_SN_1", * spaceId: spaceId, * productId: productId, * secret: secret, * tags: { * foo: "bar", * key: "value", * }, * }); * const subDevice = new huaweicloud.iotda.Device("subDevice", { * nodeId: "device_SN_2", * spaceId: spaceId, * productId: productId, * gatewayId: device.id, * }); * ``` * * ## Import * * Devices can be imported using the `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:IoTDA/device:Device test 10022532f4f94f26b01daa1e424853e1 * ``` * * Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`force_disconnect`, `extension_info`, `shadow`. It is generally recommended running `terraform plan` after importing a resource. You can then decide if changes should be applied to the resource, or the resource definition should be updated to align with the resource. Also you can ignore changes as below. hcl resource "huaweicloud_iotda_device" "test" { * * ... * * lifecycle { * * ignore_changes = [ * * force_disconnect, extension_info, shadow, * * ] * * } } */ class Device extends pulumi.CustomResource { /** * Get an existing Device resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new Device(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Device. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Device.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["authType"] = state ? state.authType : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["deviceId"] = state ? state.deviceId : undefined; resourceInputs["extensionInfo"] = state ? state.extensionInfo : undefined; resourceInputs["fingerprint"] = state ? state.fingerprint : undefined; resourceInputs["forceDisconnect"] = state ? state.forceDisconnect : undefined; resourceInputs["frozen"] = state ? state.frozen : undefined; resourceInputs["gatewayId"] = state ? state.gatewayId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["nodeId"] = state ? state.nodeId : undefined; resourceInputs["nodeType"] = state ? state.nodeType : undefined; resourceInputs["productId"] = state ? state.productId : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["secondaryFingerprint"] = state ? state.secondaryFingerprint : undefined; resourceInputs["secondarySecret"] = state ? state.secondarySecret : undefined; resourceInputs["secret"] = state ? state.secret : undefined; resourceInputs["secureAccess"] = state ? state.secureAccess : undefined; resourceInputs["shadows"] = state ? state.shadows : undefined; resourceInputs["spaceId"] = state ? state.spaceId : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["tags"] = state ? state.tags : undefined; } else { const args = argsOrState; if ((!args || args.nodeId === undefined) && !opts.urn) { throw new Error("Missing required property 'nodeId'"); } if ((!args || args.productId === undefined) && !opts.urn) { throw new Error("Missing required property 'productId'"); } if ((!args || args.spaceId === undefined) && !opts.urn) { throw new Error("Missing required property 'spaceId'"); } resourceInputs["description"] = args ? args.description : undefined; resourceInputs["deviceId"] = args ? args.deviceId : undefined; resourceInputs["extensionInfo"] = args ? args.extensionInfo : undefined; resourceInputs["fingerprint"] = args ? args.fingerprint : undefined; resourceInputs["forceDisconnect"] = args ? args.forceDisconnect : undefined; resourceInputs["frozen"] = args ? args.frozen : undefined; resourceInputs["gatewayId"] = args ? args.gatewayId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["nodeId"] = args ? args.nodeId : undefined; resourceInputs["productId"] = args ? args.productId : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["secondaryFingerprint"] = args ? args.secondaryFingerprint : undefined; resourceInputs["secondarySecret"] = args ? args.secondarySecret : undefined; resourceInputs["secret"] = args ? args.secret : undefined; resourceInputs["secureAccess"] = args ? args.secureAccess : undefined; resourceInputs["shadows"] = args ? args.shadows : undefined; resourceInputs["spaceId"] = args ? args.spaceId : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["authType"] = undefined /*out*/; resourceInputs["nodeType"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Device.__pulumiType, name, resourceInputs, opts); } } exports.Device = Device; /** @internal */ Device.__pulumiType = 'huaweicloud:IoTDA/device:Device'; //# sourceMappingURL=device.js.map