UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

114 lines 4.93 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.CustomImage = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a resource which can be used to create a [custom image](https://www.digitalocean.com/docs/images/custom-images/) * from a URL. The URL must point to an image in one of the following file formats: * * - Raw (.img) with an MBR or GPT partition table * - qcow2 * - VHDX * - VDI * - VMDK * * The image may be compressed using gzip or bzip2. See the DigitalOcean Custom * Image documentation for [additional requirements](https://www.digitalocean.com/docs/images/custom-images/#image-requirements). * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const flatcar = new digitalocean.CustomImage("flatcar", { * name: "flatcar", * url: "https://stable.release.flatcar-linux.net/amd64-usr/2605.7.0/flatcar_production_digitalocean_image.bin.bz2", * regions: ["nyc3"], * }); * const example = new digitalocean.Droplet("example", { * image: flatcar.id, * name: "example-01", * region: digitalocean.Region.NYC3, * size: digitalocean.DropletSlug.DropletS1VCPU1GB, * sshKeys: ["12345"], * }); * ``` */ class CustomImage extends pulumi.CustomResource { /** * Get an existing CustomImage 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 CustomImage(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of CustomImage. 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'] === CustomImage.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createdAt"] = state?.createdAt; resourceInputs["description"] = state?.description; resourceInputs["distribution"] = state?.distribution; resourceInputs["imageId"] = state?.imageId; resourceInputs["minDiskSize"] = state?.minDiskSize; resourceInputs["name"] = state?.name; resourceInputs["public"] = state?.public; resourceInputs["regions"] = state?.regions; resourceInputs["sizeGigabytes"] = state?.sizeGigabytes; resourceInputs["slug"] = state?.slug; resourceInputs["status"] = state?.status; resourceInputs["tags"] = state?.tags; resourceInputs["type"] = state?.type; resourceInputs["url"] = state?.url; } else { const args = argsOrState; if (args?.regions === undefined && !opts.urn) { throw new Error("Missing required property 'regions'"); } if (args?.url === undefined && !opts.urn) { throw new Error("Missing required property 'url'"); } resourceInputs["description"] = args?.description; resourceInputs["distribution"] = args?.distribution; resourceInputs["name"] = args?.name; resourceInputs["regions"] = args?.regions; resourceInputs["tags"] = args?.tags; resourceInputs["url"] = args?.url; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["imageId"] = undefined /*out*/; resourceInputs["minDiskSize"] = undefined /*out*/; resourceInputs["public"] = undefined /*out*/; resourceInputs["sizeGigabytes"] = undefined /*out*/; resourceInputs["slug"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; resourceInputs["type"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(CustomImage.__pulumiType, name, resourceInputs, opts); } } exports.CustomImage = CustomImage; /** @internal */ CustomImage.__pulumiType = 'digitalocean:index/customImage:CustomImage'; //# sourceMappingURL=customImage.js.map