@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
93 lines • 3.69 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.Tag = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a DigitalOcean Tag resource. A Tag is a label that can be applied to a
* Droplet resource in order to better organize or facilitate the lookups and
* actions on it. Tags created with this resource can be referenced in your Droplet
* configuration via their ID or name.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* // Create a new tag
* const foobar = new digitalocean.Tag("foobar", {name: "foobar"});
* // Create a new Droplet in nyc3 with the foobar tag
* const web = new digitalocean.Droplet("web", {
* image: "ubuntu-18-04-x64",
* name: "web-1",
* region: digitalocean.Region.NYC3,
* size: digitalocean.DropletSlug.DropletS1VCPU1GB,
* tags: [foobar.id],
* });
* ```
*
* ## Import
*
* Tags can be imported using the `name`, e.g.
*
* ```sh
* $ pulumi import digitalocean:index/tag:Tag mytag tagname
* ```
*/
class Tag extends pulumi.CustomResource {
/**
* Get an existing Tag 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 Tag(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Tag. 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'] === Tag.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["databasesCount"] = state?.databasesCount;
resourceInputs["dropletsCount"] = state?.dropletsCount;
resourceInputs["imagesCount"] = state?.imagesCount;
resourceInputs["name"] = state?.name;
resourceInputs["totalResourceCount"] = state?.totalResourceCount;
resourceInputs["volumeSnapshotsCount"] = state?.volumeSnapshotsCount;
resourceInputs["volumesCount"] = state?.volumesCount;
}
else {
const args = argsOrState;
resourceInputs["name"] = args?.name;
resourceInputs["databasesCount"] = undefined /*out*/;
resourceInputs["dropletsCount"] = undefined /*out*/;
resourceInputs["imagesCount"] = undefined /*out*/;
resourceInputs["totalResourceCount"] = undefined /*out*/;
resourceInputs["volumeSnapshotsCount"] = undefined /*out*/;
resourceInputs["volumesCount"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Tag.__pulumiType, name, resourceInputs, opts);
}
}
exports.Tag = Tag;
/** @internal */
Tag.__pulumiType = 'digitalocean:index/tag:Tag';
//# sourceMappingURL=tag.js.map