@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
87 lines • 3.39 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.Vpc = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an IEC VPC resource within HuaweiCloud.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vpcName = config.requireObject("vpcName");
* const vpcCidr = config.requireObject("vpcCidr");
* const vpc = new huaweicloud.iec.Vpc("vpc", {cidr: vpcCidr});
* const vpcByCustomer = new huaweicloud.iec.Vpc("vpcByCustomer", {
* cidr: vpcCidr,
* mode: "CUSTOMER",
* });
* ```
*
* ## Import
*
* VPCs can be imported using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Iec/vpc:Vpc myvpc 7117d38e-4c8f-4624-a505-bd96b97d024c
* ```
*/
class Vpc extends pulumi.CustomResource {
/**
* Get an existing Vpc 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 Vpc(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Vpc. 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'] === Vpc.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["cidr"] = state ? state.cidr : undefined;
resourceInputs["mode"] = state ? state.mode : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["subnetNum"] = state ? state.subnetNum : undefined;
}
else {
const args = argsOrState;
if ((!args || args.cidr === undefined) && !opts.urn) {
throw new Error("Missing required property 'cidr'");
}
resourceInputs["cidr"] = args ? args.cidr : undefined;
resourceInputs["mode"] = args ? args.mode : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["subnetNum"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Vpc.__pulumiType, name, resourceInputs, opts);
}
}
exports.Vpc = Vpc;
/** @internal */
Vpc.__pulumiType = 'huaweicloud:Iec/vpc:Vpc';
//# sourceMappingURL=vpc.js.map