@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
144 lines • 5.77 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.DropletAutoscale = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
* Provides a DigitalOcean Droplet Autoscale resource. This can be used to create, modify,
* read and delete Droplet Autoscale pools.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* import * as std from "@pulumi/std";
*
* const my_ssh_key = new digitalocean.SshKey("my-ssh-key", {
* name: "terraform-example",
* publicKey: std.file({
* input: "/Users/terraform/.ssh/id_rsa.pub",
* }).then(invoke => invoke.result),
* });
* const my_tag = new digitalocean.Tag("my-tag", {name: "terraform-example"});
* const my_autoscale_pool = new digitalocean.DropletAutoscale("my-autoscale-pool", {
* name: "terraform-example",
* config: {
* minInstances: 10,
* maxInstances: 50,
* targetCpuUtilization: 0.5,
* targetMemoryUtilization: 0.5,
* cooldownMinutes: 5,
* },
* dropletTemplate: {
* size: "c-2",
* region: "nyc3",
* image: "ubuntu-24-04-x64",
* tags: [my_tag.id],
* sshKeys: [my_ssh_key.id],
* withDropletAgent: true,
* ipv6: true,
* userData: `
* #cloud-config
* runcmd:
* - apt-get update
* - apt-get install -y stress-ng
* `,
* publicNetworking: false,
* },
* });
* ```
*
* ## Import
*
* Droplet Autoscale pools can be imported using their `id`, e.g.
*
* ```sh
* $ pulumi import digitalocean:index/dropletAutoscale:DropletAutoscale my-autoscale-pool 38e66834-d741-47ec-88e7-c70cbdcz0445
* ```
*/
class DropletAutoscale extends pulumi.CustomResource {
/**
* Get an existing DropletAutoscale 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 DropletAutoscale(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'digitalocean:index/dropletAutoscale:DropletAutoscale';
/**
* Returns true if the given object is an instance of DropletAutoscale. 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'] === DropletAutoscale.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["config"] = state?.config;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["currentUtilizations"] = state?.currentUtilizations;
resourceInputs["dropletTemplate"] = state?.dropletTemplate;
resourceInputs["name"] = state?.name;
resourceInputs["status"] = state?.status;
resourceInputs["updatedAt"] = state?.updatedAt;
}
else {
const args = argsOrState;
if (args?.config === undefined && !opts.urn) {
throw new Error("Missing required property 'config'");
}
if (args?.dropletTemplate === undefined && !opts.urn) {
throw new Error("Missing required property 'dropletTemplate'");
}
resourceInputs["config"] = args?.config;
resourceInputs["dropletTemplate"] = args?.dropletTemplate;
resourceInputs["name"] = args?.name;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["currentUtilizations"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DropletAutoscale.__pulumiType, name, resourceInputs, opts);
}
}
exports.DropletAutoscale = DropletAutoscale;
//# sourceMappingURL=dropletAutoscale.js.map