@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
120 lines • 4.92 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.DropletAutoscale = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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
* `,
* },
* });
* ```
*
* ## 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, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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 ? state.config : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["currentUtilizations"] = state ? state.currentUtilizations : undefined;
resourceInputs["dropletTemplate"] = state ? state.dropletTemplate : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["updatedAt"] = state ? state.updatedAt : undefined;
}
else {
const args = argsOrState;
if ((!args || args.config === undefined) && !opts.urn) {
throw new Error("Missing required property 'config'");
}
if ((!args || args.dropletTemplate === undefined) && !opts.urn) {
throw new Error("Missing required property 'dropletTemplate'");
}
resourceInputs["config"] = args ? args.config : undefined;
resourceInputs["dropletTemplate"] = args ? args.dropletTemplate : undefined;
resourceInputs["name"] = args ? args.name : undefined;
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;
/** @internal */
DropletAutoscale.__pulumiType = 'digitalocean:index/dropletAutoscale:DropletAutoscale';
//# sourceMappingURL=dropletAutoscale.js.map