@ediri/vultr
Version:
A Pulumi package for creating and managing Vultr cloud resources.
99 lines • 3.67 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.Vpc = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a Vultr VPC resource. This can be used to create, read, and delete VPCs on your Vultr account.
*
* ## Example Usage
*
* Create a new VPC with an automatically generated CIDR block:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vultr from "@ediri/vultr";
*
* const myVpc = new vultr.Vpc("myVpc", {
* description: "my vpc",
* region: "ewr",
* });
* ```
*
* Create a new VPC with a specified CIDR block:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vultr from "@ediri/vultr";
*
* const myVpc = new vultr.Vpc("myVpc", {
* description: "my private vpc",
* region: "ewr",
* v4Subnet: "10.0.0.0",
* v4SubnetMask: 24,
* });
* ```
*
* ## Import
*
* VPCs can be imported using the VPC `ID`, e.g.
*
* ```sh
* $ pulumi import vultr:index/vpc:Vpc my_vpc 0e04f918-575e-41cb-86f6-d729b354a5a1
* ```
*/
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["dateCreated"] = state ? state.dateCreated : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["v4Subnet"] = state ? state.v4Subnet : undefined;
resourceInputs["v4SubnetMask"] = state ? state.v4SubnetMask : 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["region"] = args ? args.region : undefined;
resourceInputs["v4Subnet"] = args ? args.v4Subnet : undefined;
resourceInputs["v4SubnetMask"] = args ? args.v4SubnetMask : undefined;
resourceInputs["dateCreated"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Vpc.__pulumiType, name, resourceInputs, opts);
}
}
exports.Vpc = Vpc;
/** @internal */
Vpc.__pulumiType = 'vultr:index/vpc:Vpc';
//# sourceMappingURL=vpc.js.map