UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

114 lines 4.47 kB
"use strict"; // *** 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.Vpc = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a [DigitalOcean VPC](https://docs.digitalocean.com/reference/api/digitalocean/#tag/VPCs) resource. * * VPCs are virtual networks containing resources that can communicate with each * other in full isolation, using private IP addresses. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const example = new digitalocean.Vpc("example", { * name: "example-project-network", * region: "nyc3", * ipRange: "10.10.10.0/24", * }); * ``` * * ### Resource Assignment * * `digitalocean.Droplet`, `digitalocean.KubernetesCluster`, * `digitaloceanLoadBalancer`, and `digitalocean.DatabaseCluster` resources * may be assigned to a VPC by referencing its `id`. For example: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const example = new digitalocean.Vpc("example", { * name: "example-project-network", * region: "nyc3", * }); * const exampleDroplet = new digitalocean.Droplet("example", { * name: "example-01", * size: digitalocean.DropletSlug.DropletS1VCPU1GB, * image: "ubuntu-18-04-x64", * region: digitalocean.Region.NYC3, * vpcUuid: example.id, * }); * ``` * * ## Import * * A VPC can be imported using its `id`, e.g. * * ```sh * $ pulumi import digitalocean:index/vpc:Vpc example 506f78a4-e098-11e5-ad9f-000f53306ae1 * ``` */ 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["createdAt"] = state ? state.createdAt : undefined; resourceInputs["default"] = state ? state.default : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["ipRange"] = state ? state.ipRange : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["vpcUrn"] = state ? state.vpcUrn : undefined; } else { const args = argsOrState; if ((!args || args.region === undefined) && !opts.urn) { throw new Error("Missing required property 'region'"); } resourceInputs["description"] = args ? args.description : undefined; resourceInputs["ipRange"] = args ? args.ipRange : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["default"] = undefined /*out*/; resourceInputs["vpcUrn"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Vpc.__pulumiType, name, resourceInputs, opts); } } exports.Vpc = Vpc; /** @internal */ Vpc.__pulumiType = 'digitalocean:index/vpc:Vpc'; //# sourceMappingURL=vpc.js.map