UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

110 lines 4.85 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.VpcSubnet = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a VPC subnet resource within HuaweiCloud IEC. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const sitesTest = huaweicloud.Iec.getSites({}); * const vpcTest = new huaweicloud.iec.Vpc("vpcTest", { * cidr: "192.168.0.0/16", * mode: "CUSTOMER", * }); * const subnetTest = new huaweicloud.iec.VpcSubnet("subnetTest", { * cidr: "192.168.128.0/18", * vpcId: vpcTest.id, * siteId: sitesTest.then(sitesTest => sitesTest.sites?[0]?.id), * gatewayIp: "192.168.128.1", * }); * ``` * * ## Import * * IEC vpc subnet can be imported using the `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:Iec/vpcSubnet:VpcSubnet subnet_demo 51be9f2b-5a3b-406a-9271-36f0c929fbcc * ``` */ class VpcSubnet extends pulumi.CustomResource { /** * Get an existing VpcSubnet 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 VpcSubnet(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of VpcSubnet. 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'] === VpcSubnet.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["cidr"] = state ? state.cidr : undefined; resourceInputs["dhcpEnable"] = state ? state.dhcpEnable : undefined; resourceInputs["dnsLists"] = state ? state.dnsLists : undefined; resourceInputs["gatewayIp"] = state ? state.gatewayIp : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["siteId"] = state ? state.siteId : undefined; resourceInputs["siteInfo"] = state ? state.siteInfo : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["vpcId"] = state ? state.vpcId : undefined; } else { const args = argsOrState; if ((!args || args.cidr === undefined) && !opts.urn) { throw new Error("Missing required property 'cidr'"); } if ((!args || args.gatewayIp === undefined) && !opts.urn) { throw new Error("Missing required property 'gatewayIp'"); } if ((!args || args.siteId === undefined) && !opts.urn) { throw new Error("Missing required property 'siteId'"); } if ((!args || args.vpcId === undefined) && !opts.urn) { throw new Error("Missing required property 'vpcId'"); } resourceInputs["cidr"] = args ? args.cidr : undefined; resourceInputs["dhcpEnable"] = args ? args.dhcpEnable : undefined; resourceInputs["dnsLists"] = args ? args.dnsLists : undefined; resourceInputs["gatewayIp"] = args ? args.gatewayIp : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["siteId"] = args ? args.siteId : undefined; resourceInputs["vpcId"] = args ? args.vpcId : undefined; resourceInputs["siteInfo"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(VpcSubnet.__pulumiType, name, resourceInputs, opts); } } exports.VpcSubnet = VpcSubnet; /** @internal */ VpcSubnet.__pulumiType = 'huaweicloud:Iec/vpcSubnet:VpcSubnet'; //# sourceMappingURL=vpcSubnet.js.map