UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

97 lines 4.01 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.DropletSnapshot = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a resource which can be used to create a snapshot from an existing DigitalOcean Droplet. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const web = new digitalocean.Droplet("web", { * name: "web-01", * size: digitalocean.DropletSlug.DropletS1VCPU1GB, * image: "ubuntu-22-04-x64", * region: digitalocean.Region.NYC3, * }); * const web_snapshot = new digitalocean.DropletSnapshot("web-snapshot", { * dropletId: web.id, * name: "web-snapshot-01", * }); * const from_snapshot = new digitalocean.Droplet("from-snapshot", { * image: web_snapshot.id, * name: "web-02", * region: digitalocean.Region.NYC3, * size: digitalocean.DropletSlug.DropletS2VCPU4GB, * }); * ``` * * ## Import * * Droplet Snapshots can be imported using the `snapshot id`, e.g. * * ```sh * $ pulumi import digitalocean:index/dropletSnapshot:DropletSnapshot mysnapshot 123456 * ``` */ class DropletSnapshot extends pulumi.CustomResource { /** * Get an existing DropletSnapshot 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 DropletSnapshot(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of DropletSnapshot. 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'] === DropletSnapshot.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["dropletId"] = state ? state.dropletId : undefined; resourceInputs["minDiskSize"] = state ? state.minDiskSize : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["regions"] = state ? state.regions : undefined; resourceInputs["size"] = state ? state.size : undefined; } else { const args = argsOrState; if ((!args || args.dropletId === undefined) && !opts.urn) { throw new Error("Missing required property 'dropletId'"); } resourceInputs["dropletId"] = args ? args.dropletId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["minDiskSize"] = undefined /*out*/; resourceInputs["regions"] = undefined /*out*/; resourceInputs["size"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DropletSnapshot.__pulumiType, name, resourceInputs, opts); } } exports.DropletSnapshot = DropletSnapshot; /** @internal */ DropletSnapshot.__pulumiType = 'digitalocean:index/dropletSnapshot:DropletSnapshot'; //# sourceMappingURL=dropletSnapshot.js.map