@upcloud/pulumi-upcloud
Version:
A Pulumi package for creating and managing UpCloud resources.
93 lines • 3.48 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.ServerGroup = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Server groups allow grouping servers and defining anti-affinity for the servers.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as upcloud from "@upcloud/pulumi-upcloud";
*
* const main = new upcloud.ServerGroup("main", {
* title: "main_group",
* antiAffinityPolicy: "yes",
* labels: {
* key1: "val1",
* key2: "val2",
* key3: "val3",
* },
* members: [
* "00b51165-fb58-4b77-bb8c-552277be1764",
* "00d56575-3821-3301-9de4-2b2bc7e35pqf",
* "000012dc-fe8c-a3y6-91f9-0db1215c36cf",
* ],
* });
* ```
*
* ## Import
*
* The `pulumi import` command can be used, for example:
*
* ```sh
* $ pulumi import upcloud:index/serverGroup:ServerGroup main ead4544f-10bf-42a3-b98a-a0fea2e2ad14
* ```
*/
class ServerGroup extends pulumi.CustomResource {
/**
* Get an existing ServerGroup 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 ServerGroup(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ServerGroup. 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'] === ServerGroup.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["antiAffinityPolicy"] = state?.antiAffinityPolicy;
resourceInputs["labels"] = state?.labels;
resourceInputs["members"] = state?.members;
resourceInputs["title"] = state?.title;
resourceInputs["trackMembers"] = state?.trackMembers;
}
else {
const args = argsOrState;
if (args?.title === undefined && !opts.urn) {
throw new Error("Missing required property 'title'");
}
resourceInputs["antiAffinityPolicy"] = args?.antiAffinityPolicy;
resourceInputs["labels"] = args?.labels;
resourceInputs["members"] = args?.members;
resourceInputs["title"] = args?.title;
resourceInputs["trackMembers"] = args?.trackMembers;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ServerGroup.__pulumiType, name, resourceInputs, opts);
}
}
exports.ServerGroup = ServerGroup;
/** @internal */
ServerGroup.__pulumiType = 'upcloud:index/serverGroup:ServerGroup';
//# sourceMappingURL=serverGroup.js.map