@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
186 lines • 8.81 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.DedicatedInstance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a WAF dedicated instance resource within HuaweiCloud.
*
* ## Example Usage
* ### Creating with common tenant
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const azName = config.requireObject("azName");
* const ecsFlavorId = config.requireObject("ecsFlavorId");
* const vpcId = config.requireObject("vpcId");
* const subnetId = config.requireObject("subnetId");
* const securityGroupId = config.requireObject("securityGroupId");
* const enterpriseProjectId = config.requireObject("enterpriseProjectId");
* const test = new huaweicloud.waf.DedicatedInstance("test", {
* availableZone: azName,
* specificationCode: "waf.instance.professional",
* ecsFlavor: ecsFlavorId,
* vpcId: vpcId,
* subnetId: subnetId,
* enterpriseProjectId: enterpriseProjectId,
* tags: {
* foo: "bar",
* key: "value",
* },
* securityGroups: [securityGroupId],
* });
* ```
* ### Creating with resource tenant
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const azName = config.requireObject("azName");
* const vpcId = config.requireObject("vpcId");
* const subnetId = config.requireObject("subnetId");
* const securityGroupId = config.requireObject("securityGroupId");
* const enterpriseProjectId = config.requireObject("enterpriseProjectId");
* const test = new huaweicloud.waf.DedicatedInstance("test", {
* availableZone: azName,
* specificationCode: "waf.instance.professional",
* vpcId: vpcId,
* subnetId: subnetId,
* enterpriseProjectId: enterpriseProjectId,
* resTenant: true,
* tags: {
* foo: "bar",
* key: "value",
* },
* securityGroups: [securityGroupId],
* });
* ```
*
* ## Import
*
* There are two ways to import WAF dedicated instance state. * Using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Waf/dedicatedInstance:DedicatedInstance test <id>
* ```
*
* * Using `id` and `enterprise_project_id`, separated by a slash, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Waf/dedicatedInstance:DedicatedInstance test <id>/<enterprise_project_id>
* ```
*
* Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response. The missing attributes include`res_tenant`, `anti_affinity`, and `tags`. It is generally recommended running `terraform plan` after importing the 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_waf_dedicated_instance" "test" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* res_tenant, anti_affinity, tags,
*
* ]
*
* } }
*/
class DedicatedInstance extends pulumi.CustomResource {
/**
* Get an existing DedicatedInstance 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 DedicatedInstance(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of DedicatedInstance. 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'] === DedicatedInstance.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessStatus"] = state ? state.accessStatus : undefined;
resourceInputs["antiAffinity"] = state ? state.antiAffinity : undefined;
resourceInputs["availableZone"] = state ? state.availableZone : undefined;
resourceInputs["cpuArchitecture"] = state ? state.cpuArchitecture : undefined;
resourceInputs["ecsFlavor"] = state ? state.ecsFlavor : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["groupId"] = state ? state.groupId : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["resTenant"] = state ? state.resTenant : undefined;
resourceInputs["runStatus"] = state ? state.runStatus : undefined;
resourceInputs["securityGroups"] = state ? state.securityGroups : undefined;
resourceInputs["serverId"] = state ? state.serverId : undefined;
resourceInputs["serviceIp"] = state ? state.serviceIp : undefined;
resourceInputs["specificationCode"] = state ? state.specificationCode : undefined;
resourceInputs["subnetId"] = state ? state.subnetId : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["upgradable"] = state ? state.upgradable : undefined;
resourceInputs["vpcId"] = state ? state.vpcId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.availableZone === undefined) && !opts.urn) {
throw new Error("Missing required property 'availableZone'");
}
if ((!args || args.securityGroups === undefined) && !opts.urn) {
throw new Error("Missing required property 'securityGroups'");
}
if ((!args || args.specificationCode === undefined) && !opts.urn) {
throw new Error("Missing required property 'specificationCode'");
}
if ((!args || args.subnetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'subnetId'");
}
if ((!args || args.vpcId === undefined) && !opts.urn) {
throw new Error("Missing required property 'vpcId'");
}
resourceInputs["antiAffinity"] = args ? args.antiAffinity : undefined;
resourceInputs["availableZone"] = args ? args.availableZone : undefined;
resourceInputs["cpuArchitecture"] = args ? args.cpuArchitecture : undefined;
resourceInputs["ecsFlavor"] = args ? args.ecsFlavor : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["groupId"] = args ? args.groupId : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["resTenant"] = args ? args.resTenant : undefined;
resourceInputs["securityGroups"] = args ? args.securityGroups : undefined;
resourceInputs["specificationCode"] = args ? args.specificationCode : undefined;
resourceInputs["subnetId"] = args ? args.subnetId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["vpcId"] = args ? args.vpcId : undefined;
resourceInputs["accessStatus"] = undefined /*out*/;
resourceInputs["runStatus"] = undefined /*out*/;
resourceInputs["serverId"] = undefined /*out*/;
resourceInputs["serviceIp"] = undefined /*out*/;
resourceInputs["upgradable"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DedicatedInstance.__pulumiType, name, resourceInputs, opts);
}
}
exports.DedicatedInstance = DedicatedInstance;
/** @internal */
DedicatedInstance.__pulumiType = 'huaweicloud:Waf/dedicatedInstance:DedicatedInstance';
//# sourceMappingURL=dedicatedInstance.js.map