@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
445 lines (444 loc) • 20.9 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import { input as inputs, output as outputs } from "../types";
/**
* 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,
*
* ]
*
* } }
*/
export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: DeviceState, opts?: pulumi.CustomResourceOptions): Device;
/**
* 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: any): obj is Device;
/**
* The authentication type of device. The options are as follows:
* + **SECRET**: Use a secret for identity authentication.
* + **CERTIFICATES**: Use an x.509 certificate for identity authentication.
*/
readonly authType: pulumi.Output<string>;
/**
* Specifies the description of device. The description contains a maximum of `2,048`
* characters. Only letters, Chinese characters, digits, hyphens (-), underscore (_) and the following special characters
* are allowed: `?'#().,&%@!`.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* Specifies the device ID, which contains `4` to `256` characters.
* Only letters, digits, hyphens (-) and underscore (_) are allowed. If omitted, the platform will automatically allocate
* a device ID. Changing this parameter will create a new resource.
*/
readonly deviceId: pulumi.Output<string>;
/**
* Specifies the extended information of the device.
* The users can be customized the content. The maximum size of the value is `1` KB.
*/
readonly extensionInfo: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* Specifies a primary fingerprint of X.509 certificate for identity authentication,
* which is a 40-digit or 64-digit hexadecimal string. For more detail, please see
* [Registering a Device Authenticated by an X.509 Certificate](https://support.huaweicloud.com/en-us/usermanual-iothub/iot_01_0055.html).
*/
readonly fingerprint: pulumi.Output<string>;
/**
* Specifies whether to force device disconnection when resetting secrets or
* fingerprints, currently, only long connections are allowed. The default value is **false**.
*/
readonly forceDisconnect: pulumi.Output<boolean | undefined>;
/**
* Specifies whether to freeze the device. Defaults to **false**.
*/
readonly frozen: pulumi.Output<boolean>;
/**
* Specifies the gateway ID which is the device ID of the parent device.
* The child device is not directly connected to the platform. If omitted, it means to create a device directly connected
* to the platform, the `deviceId` of the device is the same as the `gatewayId`.
*/
readonly gatewayId: pulumi.Output<string>;
/**
* Specifies the device name, which contains `4` to `256` characters. Only letters,
* Chinese characters, digits, hyphens (-), underscore (_) and the following special characters are allowed: `?'#().,&%@!`.
*/
readonly name: pulumi.Output<string>;
/**
* Specifies the node ID, which contains `4` to `256` characters.
* The node ID can be IMEI, MAC address, or serial number. Changing this parameter will create a new resource.
*/
readonly nodeId: pulumi.Output<string>;
/**
* The node type of device. The options are as follows:
* + **GATEWAY**: Directly connected device.
* + **ENDPOINT**: Indirectly connected device.
* + **UNKNOWN**: Unknown type.
*/
readonly nodeType: pulumi.Output<string>;
/**
* Specifies the product ID which the device belongs to.
* Changing this parameter will create a new resource.
*/
readonly productId: pulumi.Output<string>;
/**
* Specifies the region in which to create the IoTDA device resource.
* If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
*/
readonly region: pulumi.Output<string>;
/**
* Specifies a secondary fingerprint of X.509 certificate for identity
* authentication. When primary fingerprint verification fails, secondary fingerprint verification will be enabled, and
* the secondary fingerprint has the same effectiveness as the primary fingerprint.
* Which is a 40-digit or 64-digit hexadecimal string. For more detail, please see
* [Registering a Device Authenticated by an X.509 Certificate](https://support.huaweicloud.com/en-us/usermanual-iothub/iot_01_0055.html).
*/
readonly secondaryFingerprint: pulumi.Output<string>;
/**
* Specifies a secondary secret for identity authentication.
* When the primary secret verification fails, the secondary secret verification will be enabled, and the secondary
* secret has the same effect as the primary secret; The secondary secret is not effective for devices connected to the
* COAP protocol. Which contains `8` to `32` characters.
* Only letters, digits, hyphens (-) and underscore (_) are allowed.
*/
readonly secondarySecret: pulumi.Output<string>;
/**
* Specifies a primary secret for identity authentication, which contains `8` to `32`
* characters. Only letters, digits, hyphens (-) and underscore (_) are allowed.
*/
readonly secret: pulumi.Output<string>;
/**
* Specifies whether the device is connected through a secure protocol.
* This parameter is only valid when `secret` or `fingerprint` is specified, and suggest setting it to **true**.
* If ignored, it means accessing through insecure protocols, and the device is susceptible to security risks such as
* counterfeiting, please be cautious with this configuration.
*/
readonly secureAccess: pulumi.Output<boolean>;
/**
* Specifies the initial configuration of the device.
* The shadow structure is documented below.
*/
readonly shadows: pulumi.Output<outputs.IoTDA.DeviceShadow[] | undefined>;
/**
* Specifies the resource space ID which the device belongs to.
* Changing this parameter will create a new resource.
*/
readonly spaceId: pulumi.Output<string>;
/**
* The status of device. The valid values are **INACTIVE**, **ONLINE**, **OFFLINE**, **FROZEN**, **ABNORMAL**.
*/
readonly status: pulumi.Output<string>;
/**
* Specifies the key/value pairs to associate with the device.
*/
readonly tags: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* Create a Device resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: DeviceArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Device resources.
*/
export interface DeviceState {
/**
* The authentication type of device. The options are as follows:
* + **SECRET**: Use a secret for identity authentication.
* + **CERTIFICATES**: Use an x.509 certificate for identity authentication.
*/
authType?: pulumi.Input<string>;
/**
* Specifies the description of device. The description contains a maximum of `2,048`
* characters. Only letters, Chinese characters, digits, hyphens (-), underscore (_) and the following special characters
* are allowed: `?'#().,&%@!`.
*/
description?: pulumi.Input<string>;
/**
* Specifies the device ID, which contains `4` to `256` characters.
* Only letters, digits, hyphens (-) and underscore (_) are allowed. If omitted, the platform will automatically allocate
* a device ID. Changing this parameter will create a new resource.
*/
deviceId?: pulumi.Input<string>;
/**
* Specifies the extended information of the device.
* The users can be customized the content. The maximum size of the value is `1` KB.
*/
extensionInfo?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Specifies a primary fingerprint of X.509 certificate for identity authentication,
* which is a 40-digit or 64-digit hexadecimal string. For more detail, please see
* [Registering a Device Authenticated by an X.509 Certificate](https://support.huaweicloud.com/en-us/usermanual-iothub/iot_01_0055.html).
*/
fingerprint?: pulumi.Input<string>;
/**
* Specifies whether to force device disconnection when resetting secrets or
* fingerprints, currently, only long connections are allowed. The default value is **false**.
*/
forceDisconnect?: pulumi.Input<boolean>;
/**
* Specifies whether to freeze the device. Defaults to **false**.
*/
frozen?: pulumi.Input<boolean>;
/**
* Specifies the gateway ID which is the device ID of the parent device.
* The child device is not directly connected to the platform. If omitted, it means to create a device directly connected
* to the platform, the `deviceId` of the device is the same as the `gatewayId`.
*/
gatewayId?: pulumi.Input<string>;
/**
* Specifies the device name, which contains `4` to `256` characters. Only letters,
* Chinese characters, digits, hyphens (-), underscore (_) and the following special characters are allowed: `?'#().,&%@!`.
*/
name?: pulumi.Input<string>;
/**
* Specifies the node ID, which contains `4` to `256` characters.
* The node ID can be IMEI, MAC address, or serial number. Changing this parameter will create a new resource.
*/
nodeId?: pulumi.Input<string>;
/**
* The node type of device. The options are as follows:
* + **GATEWAY**: Directly connected device.
* + **ENDPOINT**: Indirectly connected device.
* + **UNKNOWN**: Unknown type.
*/
nodeType?: pulumi.Input<string>;
/**
* Specifies the product ID which the device belongs to.
* Changing this parameter will create a new resource.
*/
productId?: pulumi.Input<string>;
/**
* Specifies the region in which to create the IoTDA device resource.
* If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
*/
region?: pulumi.Input<string>;
/**
* Specifies a secondary fingerprint of X.509 certificate for identity
* authentication. When primary fingerprint verification fails, secondary fingerprint verification will be enabled, and
* the secondary fingerprint has the same effectiveness as the primary fingerprint.
* Which is a 40-digit or 64-digit hexadecimal string. For more detail, please see
* [Registering a Device Authenticated by an X.509 Certificate](https://support.huaweicloud.com/en-us/usermanual-iothub/iot_01_0055.html).
*/
secondaryFingerprint?: pulumi.Input<string>;
/**
* Specifies a secondary secret for identity authentication.
* When the primary secret verification fails, the secondary secret verification will be enabled, and the secondary
* secret has the same effect as the primary secret; The secondary secret is not effective for devices connected to the
* COAP protocol. Which contains `8` to `32` characters.
* Only letters, digits, hyphens (-) and underscore (_) are allowed.
*/
secondarySecret?: pulumi.Input<string>;
/**
* Specifies a primary secret for identity authentication, which contains `8` to `32`
* characters. Only letters, digits, hyphens (-) and underscore (_) are allowed.
*/
secret?: pulumi.Input<string>;
/**
* Specifies whether the device is connected through a secure protocol.
* This parameter is only valid when `secret` or `fingerprint` is specified, and suggest setting it to **true**.
* If ignored, it means accessing through insecure protocols, and the device is susceptible to security risks such as
* counterfeiting, please be cautious with this configuration.
*/
secureAccess?: pulumi.Input<boolean>;
/**
* Specifies the initial configuration of the device.
* The shadow structure is documented below.
*/
shadows?: pulumi.Input<pulumi.Input<inputs.IoTDA.DeviceShadow>[]>;
/**
* Specifies the resource space ID which the device belongs to.
* Changing this parameter will create a new resource.
*/
spaceId?: pulumi.Input<string>;
/**
* The status of device. The valid values are **INACTIVE**, **ONLINE**, **OFFLINE**, **FROZEN**, **ABNORMAL**.
*/
status?: pulumi.Input<string>;
/**
* Specifies the key/value pairs to associate with the device.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
}
/**
* The set of arguments for constructing a Device resource.
*/
export interface DeviceArgs {
/**
* Specifies the description of device. The description contains a maximum of `2,048`
* characters. Only letters, Chinese characters, digits, hyphens (-), underscore (_) and the following special characters
* are allowed: `?'#().,&%@!`.
*/
description?: pulumi.Input<string>;
/**
* Specifies the device ID, which contains `4` to `256` characters.
* Only letters, digits, hyphens (-) and underscore (_) are allowed. If omitted, the platform will automatically allocate
* a device ID. Changing this parameter will create a new resource.
*/
deviceId?: pulumi.Input<string>;
/**
* Specifies the extended information of the device.
* The users can be customized the content. The maximum size of the value is `1` KB.
*/
extensionInfo?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Specifies a primary fingerprint of X.509 certificate for identity authentication,
* which is a 40-digit or 64-digit hexadecimal string. For more detail, please see
* [Registering a Device Authenticated by an X.509 Certificate](https://support.huaweicloud.com/en-us/usermanual-iothub/iot_01_0055.html).
*/
fingerprint?: pulumi.Input<string>;
/**
* Specifies whether to force device disconnection when resetting secrets or
* fingerprints, currently, only long connections are allowed. The default value is **false**.
*/
forceDisconnect?: pulumi.Input<boolean>;
/**
* Specifies whether to freeze the device. Defaults to **false**.
*/
frozen?: pulumi.Input<boolean>;
/**
* Specifies the gateway ID which is the device ID of the parent device.
* The child device is not directly connected to the platform. If omitted, it means to create a device directly connected
* to the platform, the `deviceId` of the device is the same as the `gatewayId`.
*/
gatewayId?: pulumi.Input<string>;
/**
* Specifies the device name, which contains `4` to `256` characters. Only letters,
* Chinese characters, digits, hyphens (-), underscore (_) and the following special characters are allowed: `?'#().,&%@!`.
*/
name?: pulumi.Input<string>;
/**
* Specifies the node ID, which contains `4` to `256` characters.
* The node ID can be IMEI, MAC address, or serial number. Changing this parameter will create a new resource.
*/
nodeId: pulumi.Input<string>;
/**
* Specifies the product ID which the device belongs to.
* Changing this parameter will create a new resource.
*/
productId: pulumi.Input<string>;
/**
* Specifies the region in which to create the IoTDA device resource.
* If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
*/
region?: pulumi.Input<string>;
/**
* Specifies a secondary fingerprint of X.509 certificate for identity
* authentication. When primary fingerprint verification fails, secondary fingerprint verification will be enabled, and
* the secondary fingerprint has the same effectiveness as the primary fingerprint.
* Which is a 40-digit or 64-digit hexadecimal string. For more detail, please see
* [Registering a Device Authenticated by an X.509 Certificate](https://support.huaweicloud.com/en-us/usermanual-iothub/iot_01_0055.html).
*/
secondaryFingerprint?: pulumi.Input<string>;
/**
* Specifies a secondary secret for identity authentication.
* When the primary secret verification fails, the secondary secret verification will be enabled, and the secondary
* secret has the same effect as the primary secret; The secondary secret is not effective for devices connected to the
* COAP protocol. Which contains `8` to `32` characters.
* Only letters, digits, hyphens (-) and underscore (_) are allowed.
*/
secondarySecret?: pulumi.Input<string>;
/**
* Specifies a primary secret for identity authentication, which contains `8` to `32`
* characters. Only letters, digits, hyphens (-) and underscore (_) are allowed.
*/
secret?: pulumi.Input<string>;
/**
* Specifies whether the device is connected through a secure protocol.
* This parameter is only valid when `secret` or `fingerprint` is specified, and suggest setting it to **true**.
* If ignored, it means accessing through insecure protocols, and the device is susceptible to security risks such as
* counterfeiting, please be cautious with this configuration.
*/
secureAccess?: pulumi.Input<boolean>;
/**
* Specifies the initial configuration of the device.
* The shadow structure is documented below.
*/
shadows?: pulumi.Input<pulumi.Input<inputs.IoTDA.DeviceShadow>[]>;
/**
* Specifies the resource space ID which the device belongs to.
* Changing this parameter will create a new resource.
*/
spaceId: pulumi.Input<string>;
/**
* Specifies the key/value pairs to associate with the device.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
}