@pulumi/openstack
Version:
A Pulumi package for creating and managing OpenStack cloud resources.
121 lines • 6.19 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** 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");
/**
* Manages a V2 Neutron subnet resource within OpenStack.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const network1 = new openstack.networking.Network("network_1", {
* name: "tf_test_network",
* adminStateUp: true,
* });
* const subnet1 = new openstack.networking.Subnet("subnet_1", {
* networkId: network1.id,
* cidr: "192.168.199.0/24",
* });
* ```
*
* ## Import
*
* Subnets can be imported using the `id`, e.g.
*
* ```sh
* $ pulumi import openstack:networking/subnet:Subnet subnet_1 da4faf16-5546-41e4-8330-4d0002b74048
* ```
*/
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["allTags"] = state ? state.allTags : undefined;
resourceInputs["allocationPools"] = state ? state.allocationPools : undefined;
resourceInputs["cidr"] = state ? state.cidr : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["dnsNameservers"] = state ? state.dnsNameservers : undefined;
resourceInputs["dnsPublishFixedIp"] = state ? state.dnsPublishFixedIp : undefined;
resourceInputs["enableDhcp"] = state ? state.enableDhcp : undefined;
resourceInputs["gatewayIp"] = state ? state.gatewayIp : undefined;
resourceInputs["ipVersion"] = state ? state.ipVersion : undefined;
resourceInputs["ipv6AddressMode"] = state ? state.ipv6AddressMode : undefined;
resourceInputs["ipv6RaMode"] = state ? state.ipv6RaMode : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["networkId"] = state ? state.networkId : undefined;
resourceInputs["noGateway"] = state ? state.noGateway : undefined;
resourceInputs["prefixLength"] = state ? state.prefixLength : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["segmentId"] = state ? state.segmentId : undefined;
resourceInputs["serviceTypes"] = state ? state.serviceTypes : undefined;
resourceInputs["subnetpoolId"] = state ? state.subnetpoolId : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tenantId"] = state ? state.tenantId : undefined;
resourceInputs["valueSpecs"] = state ? state.valueSpecs : undefined;
}
else {
const args = argsOrState;
if ((!args || args.networkId === undefined) && !opts.urn) {
throw new Error("Missing required property 'networkId'");
}
resourceInputs["allocationPools"] = args ? args.allocationPools : undefined;
resourceInputs["cidr"] = args ? args.cidr : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["dnsNameservers"] = args ? args.dnsNameservers : undefined;
resourceInputs["dnsPublishFixedIp"] = args ? args.dnsPublishFixedIp : undefined;
resourceInputs["enableDhcp"] = args ? args.enableDhcp : undefined;
resourceInputs["gatewayIp"] = args ? args.gatewayIp : undefined;
resourceInputs["ipVersion"] = args ? args.ipVersion : undefined;
resourceInputs["ipv6AddressMode"] = args ? args.ipv6AddressMode : undefined;
resourceInputs["ipv6RaMode"] = args ? args.ipv6RaMode : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["networkId"] = args ? args.networkId : undefined;
resourceInputs["noGateway"] = args ? args.noGateway : undefined;
resourceInputs["prefixLength"] = args ? args.prefixLength : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["segmentId"] = args ? args.segmentId : undefined;
resourceInputs["serviceTypes"] = args ? args.serviceTypes : undefined;
resourceInputs["subnetpoolId"] = args ? args.subnetpoolId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["tenantId"] = args ? args.tenantId : undefined;
resourceInputs["valueSpecs"] = args ? args.valueSpecs : undefined;
resourceInputs["allTags"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Subnet.__pulumiType, name, resourceInputs, opts);
}
}
exports.Subnet = Subnet;
/** @internal */
Subnet.__pulumiType = 'openstack:networking/subnet:Subnet';
//# sourceMappingURL=subnet.js.map