@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
172 lines • 7.02 kB
JavaScript
;
// *** 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.Product = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a product resource 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 productName = config.requireObject("productName");
* const space = new huaweicloud.iotda.Space("space", {});
* const test = new huaweicloud.iotda.Product("test", {
* deviceType: "WaterMeter",
* protocol: "MQTT",
* spaceId: huaweicloud_iotda_space.test.id,
* dataType: "json",
* manufacturerName: "demo_manufacturer_name",
* industry: "demo_industry",
* services: [{
* id: "service_1",
* type: "serv_type",
* properties: [
* {
* name: "p_1",
* type: "int",
* min: "3",
* max: "666",
* description: "desc",
* method: "RW",
* },
* {
* name: "p_2",
* type: "string",
* maxLength: 20,
* enumLists: [
* "1",
* "E",
* ],
* method: "R",
* },
* {
* name: "p_3",
* type: "string",
* method: "W",
* maxLength: 200,
* },
* {
* name: "p_4",
* type: "decimal",
* method: "W",
* min: "3.1",
* max: "666.99",
* },
* ],
* commands: [{
* name: "cmd_1",
* paras: [{
* name: "cmd_p_1",
* type: "int",
* description: "desc",
* min: "1",
* max: "33",
* }],
* responses: [{
* name: "cmd_r_1",
* type: "int",
* description: "desc",
* min: "1",
* max: "22",
* }],
* }],
* }],
* });
* ```
*
* ## Import
*
* The product resource can be imported using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:IoTDA/product:Product test <id>
* ```
*/
class Product extends pulumi.CustomResource {
/**
* Get an existing Product 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 Product(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Product. 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'] === Product.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["dataType"] = state ? state.dataType : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["deviceType"] = state ? state.deviceType : undefined;
resourceInputs["industry"] = state ? state.industry : undefined;
resourceInputs["manufacturerName"] = state ? state.manufacturerName : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["productId"] = state ? state.productId : undefined;
resourceInputs["protocol"] = state ? state.protocol : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["services"] = state ? state.services : undefined;
resourceInputs["spaceId"] = state ? state.spaceId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.dataType === undefined) && !opts.urn) {
throw new Error("Missing required property 'dataType'");
}
if ((!args || args.deviceType === undefined) && !opts.urn) {
throw new Error("Missing required property 'deviceType'");
}
if ((!args || args.protocol === undefined) && !opts.urn) {
throw new Error("Missing required property 'protocol'");
}
if ((!args || args.services === undefined) && !opts.urn) {
throw new Error("Missing required property 'services'");
}
resourceInputs["dataType"] = args ? args.dataType : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["deviceType"] = args ? args.deviceType : undefined;
resourceInputs["industry"] = args ? args.industry : undefined;
resourceInputs["manufacturerName"] = args ? args.manufacturerName : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["productId"] = args ? args.productId : undefined;
resourceInputs["protocol"] = args ? args.protocol : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["services"] = args ? args.services : undefined;
resourceInputs["spaceId"] = args ? args.spaceId : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Product.__pulumiType, name, resourceInputs, opts);
}
}
exports.Product = Product;
/** @internal */
Product.__pulumiType = 'huaweicloud:IoTDA/product:Product';
//# sourceMappingURL=product.js.map