UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

112 lines 4.75 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.Vpc = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a 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.get("vpcName") || "huaweicloud_vpc"; * const vpcCidr = config.get("vpcCidr") || "192.168.0.0/16"; * const vpc = new huaweicloud.vpc.Vpc("vpc", {cidr: vpcCidr}); * const vpcWithTags = new huaweicloud.vpc.Vpc("vpcWithTags", { * cidr: vpcCidr, * tags: { * foo: "bar", * key: "value", * }, * }); * ``` * * ## Import * * VPCs can be imported using the `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:Vpc/vpc:Vpc vpc_v1 7117d38e-4c8f-4624-a505-bd96b97d024c * ``` * * Note that the imported state may not be identical to your resource definition when `secondary_cidr` was set. You can ignore changes as below. hcl resource "huaweicloud_vpc" "vpc_v1" { * * ... * * lifecycle { * * ignore_changes = [ secondary_cidr ] * * } } */ 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["description"] = state ? state.description : undefined; resourceInputs["enhancedLocalRoute"] = state ? state.enhancedLocalRoute : undefined; resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["routes"] = state ? state.routes : undefined; resourceInputs["secondaryCidr"] = state ? state.secondaryCidr : undefined; resourceInputs["secondaryCidrs"] = state ? state.secondaryCidrs : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["tags"] = state ? state.tags : 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["description"] = args ? args.description : undefined; resourceInputs["enhancedLocalRoute"] = args ? args.enhancedLocalRoute : undefined; resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["secondaryCidr"] = args ? args.secondaryCidr : undefined; resourceInputs["secondaryCidrs"] = args ? args.secondaryCidrs : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["routes"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Vpc.__pulumiType, name, resourceInputs, opts); } } exports.Vpc = Vpc; /** @internal */ Vpc.__pulumiType = 'huaweicloud:Vpc/vpc:Vpc'; //# sourceMappingURL=vpc.js.map