@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
151 lines • 5.2 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getImageOutput = exports.getImage = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
* Get information on an image for use in other resources (e.g. creating a Droplet
* based on snapshot). This data source provides all of the image properties as
* configured on your DigitalOcean account. This is useful if the image in question
* is not managed by Terraform or you need to utilize any of the image's data.
*
* An error is triggered if zero or more than one result is returned by the query.
*
* ## Example Usage
*
* Get the data about a snapshot:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const example1 = digitalocean.getImage({
* name: "example-1.0.0",
* });
* ```
*
* Reuse the data about a snapshot to create a Droplet:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const example = digitalocean.getImage({
* name: "example-1.0.0",
* });
* const exampleDroplet = new digitalocean.Droplet("example", {
* image: output(example.then(example => example.id)).apply(x =>String(x)),
* name: "example-1",
* region: digitalocean.Region.NYC2,
* size: digitalocean.DropletSlug.DropletS1VCPU1GB,
* });
* ```
*
* Get the data about an official image:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const example2 = digitalocean.getImage({
* slug: "ubuntu-18-04-x64",
* });
* ```
*/
function getImage(args, opts) {
args = args || {};
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invoke("digitalocean:index/getImage:getImage", {
"id": args.id,
"name": args.name,
"slug": args.slug,
"source": args.source,
}, opts);
}
exports.getImage = getImage;
/**
* Get information on an image for use in other resources (e.g. creating a Droplet
* based on snapshot). This data source provides all of the image properties as
* configured on your DigitalOcean account. This is useful if the image in question
* is not managed by Terraform or you need to utilize any of the image's data.
*
* An error is triggered if zero or more than one result is returned by the query.
*
* ## Example Usage
*
* Get the data about a snapshot:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const example1 = digitalocean.getImage({
* name: "example-1.0.0",
* });
* ```
*
* Reuse the data about a snapshot to create a Droplet:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const example = digitalocean.getImage({
* name: "example-1.0.0",
* });
* const exampleDroplet = new digitalocean.Droplet("example", {
* image: output(example.then(example => example.id)).apply(x =>String(x)),
* name: "example-1",
* region: digitalocean.Region.NYC2,
* size: digitalocean.DropletSlug.DropletS1VCPU1GB,
* });
* ```
*
* Get the data about an official image:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const example2 = digitalocean.getImage({
* slug: "ubuntu-18-04-x64",
* });
* ```
*/
function getImageOutput(args, opts) {
args = args || {};
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invokeOutput("digitalocean:index/getImage:getImage", {
"id": args.id,
"name": args.name,
"slug": args.slug,
"source": args.source,
}, opts);
}
exports.getImageOutput = getImageOutput;
//# sourceMappingURL=getImage.js.map