UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

161 lines 6.78 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.DeviceLinkageRule = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages an IoTDA device linkage rule 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 * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const spaceId = config.requireObject("spaceId"); * const triggerDeviceId = config.requireObject("triggerDeviceId"); * const actionDeviceId = config.requireObject("actionDeviceId"); * const topic = new huaweicloud.smn.Topic("topic", {}); * const test = new huaweicloud.iotda.DeviceLinkageRule("test", { * spaceId: spaceId, * triggers: [ * { * type: "SIMPLE_TIMER", * simpleTimerCondition: { * startTime: "20220622T160000Z", * repeatInterval: 2, * repeatCount: 2, * }, * }, * { * type: "DEVICE_DATA", * deviceDataCondition: { * deviceId: triggerDeviceId, * path: "service_id/propertyName_1", * operator: "=", * value: "5", * triggerStrategy: "pulse", * dataValidatiyPeriod: 300, * }, * }, * { * type: "DAILY_TIMER", * dailyTimerCondition: { * startTime: "19:02", * }, * }, * ], * actions: [ * { * type: "SMN_FORWARDING", * smnForwarding: { * region: topic.region, * topicName: topic.name, * topicUrn: topic.topicUrn, * messageTitle: "message_title", * messageContent: "message_content", * }, * }, * { * type: "DEVICE_CMD", * deviceCommand: { * deviceId: actionDeviceId, * serviceId: "service_id", * commandName: "cmd_name", * commandBody: "{\"cmd_parameter_1\":\"3\"}", * }, * }, * ], * effectivePeriod: { * startTime: "00:00", * endTime: "23:59", * daysOfWeek: "1,2,3", * }, * }); * ``` * * ## Import * * Device linkage rules can be imported using the `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:IoTDA/deviceLinkageRule:DeviceLinkageRule test 62b6cc5aa367f403fea86127 * ``` */ class DeviceLinkageRule extends pulumi.CustomResource { /** * Get an existing DeviceLinkageRule 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 DeviceLinkageRule(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of DeviceLinkageRule. 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'] === DeviceLinkageRule.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["actions"] = state ? state.actions : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["effectivePeriod"] = state ? state.effectivePeriod : undefined; resourceInputs["enabled"] = state ? state.enabled : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["spaceId"] = state ? state.spaceId : undefined; resourceInputs["triggerLogic"] = state ? state.triggerLogic : undefined; resourceInputs["triggers"] = state ? state.triggers : undefined; } else { const args = argsOrState; if ((!args || args.actions === undefined) && !opts.urn) { throw new Error("Missing required property 'actions'"); } if ((!args || args.spaceId === undefined) && !opts.urn) { throw new Error("Missing required property 'spaceId'"); } if ((!args || args.triggers === undefined) && !opts.urn) { throw new Error("Missing required property 'triggers'"); } resourceInputs["actions"] = args ? args.actions : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["effectivePeriod"] = args ? args.effectivePeriod : undefined; resourceInputs["enabled"] = args ? args.enabled : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["spaceId"] = args ? args.spaceId : undefined; resourceInputs["triggerLogic"] = args ? args.triggerLogic : undefined; resourceInputs["triggers"] = args ? args.triggers : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DeviceLinkageRule.__pulumiType, name, resourceInputs, opts); } } exports.DeviceLinkageRule = DeviceLinkageRule; /** @internal */ DeviceLinkageRule.__pulumiType = 'huaweicloud:IoTDA/deviceLinkageRule:DeviceLinkageRule'; //# sourceMappingURL=deviceLinkageRule.js.map