@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
107 lines • 5.67 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.Subnet = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a VPC subnet resource within HuaweiCloud.
*
* ## Import
*
* Subnets can be imported using the subnet `Network ID`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Vpc/subnet:Subnet subnet 4779ab1c-7c1a-44b1-a02e-93dfc361b32d
* ```
*/
class Subnet extends pulumi.CustomResource {
/**
* Get an existing Subnet 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 Subnet(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Subnet. 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'] === Subnet.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["availabilityZone"] = state ? state.availabilityZone : undefined;
resourceInputs["cidr"] = state ? state.cidr : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["dhcpEnable"] = state ? state.dhcpEnable : undefined;
resourceInputs["dhcpLeaseTime"] = state ? state.dhcpLeaseTime : undefined;
resourceInputs["dnsLists"] = state ? state.dnsLists : undefined;
resourceInputs["gatewayIp"] = state ? state.gatewayIp : undefined;
resourceInputs["ipv4SubnetId"] = state ? state.ipv4SubnetId : undefined;
resourceInputs["ipv6Cidr"] = state ? state.ipv6Cidr : undefined;
resourceInputs["ipv6Enable"] = state ? state.ipv6Enable : undefined;
resourceInputs["ipv6Gateway"] = state ? state.ipv6Gateway : undefined;
resourceInputs["ipv6SubnetId"] = state ? state.ipv6SubnetId : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["ntpServerAddress"] = state ? state.ntpServerAddress : undefined;
resourceInputs["primaryDns"] = state ? state.primaryDns : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["secondaryDns"] = state ? state.secondaryDns : undefined;
resourceInputs["subnetId"] = state ? state.subnetId : undefined;
resourceInputs["tags"] = state ? state.tags : 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.vpcId === undefined) && !opts.urn) {
throw new Error("Missing required property 'vpcId'");
}
resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined;
resourceInputs["cidr"] = args ? args.cidr : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["dhcpEnable"] = args ? args.dhcpEnable : undefined;
resourceInputs["dhcpLeaseTime"] = args ? args.dhcpLeaseTime : undefined;
resourceInputs["dnsLists"] = args ? args.dnsLists : undefined;
resourceInputs["gatewayIp"] = args ? args.gatewayIp : undefined;
resourceInputs["ipv6Enable"] = args ? args.ipv6Enable : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["ntpServerAddress"] = args ? args.ntpServerAddress : undefined;
resourceInputs["primaryDns"] = args ? args.primaryDns : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["secondaryDns"] = args ? args.secondaryDns : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["vpcId"] = args ? args.vpcId : undefined;
resourceInputs["ipv4SubnetId"] = undefined /*out*/;
resourceInputs["ipv6Cidr"] = undefined /*out*/;
resourceInputs["ipv6Gateway"] = undefined /*out*/;
resourceInputs["ipv6SubnetId"] = undefined /*out*/;
resourceInputs["subnetId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Subnet.__pulumiType, name, resourceInputs, opts);
}
}
exports.Subnet = Subnet;
/** @internal */
Subnet.__pulumiType = 'huaweicloud:Vpc/subnet:Subnet';
//# sourceMappingURL=subnet.js.map