@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
103 lines • 4.43 kB
JavaScript
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlacementGroupAssignment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a single assignment between a Linode and a Placement Group.
* For more information, see the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-group-add-linode).
*
* To prevent update conflicts, Linodes managed through the `linode.Instance` resource should specify `placementGroupExternallyManaged`:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const my_instance = new linode.Instance("my-instance", {placementGroupExternallyManaged: true});
* ```
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const my_pg = new linode.PlacementGroup("my-pg", {
* label: "my-pg",
* region: "us-east",
* placementGroupType: "anti_affinity:local",
* });
* const my_inst = new linode.Instance("my-inst", {
* label: "my-inst",
* region: "us-east",
* type: "g6-nanode-1",
* placementGroupExternallyManaged: true,
* });
* const my_assignment = new linode.PlacementGroupAssignment("my-assignment", {
* placementGroupId: my_pg.id,
* linodeId: my_inst.id,
* });
* ```
*
* ## Import
*
* Placement Group assignments can be imported using the Placement Group's ID followed by the Linode's ID separated by a comma, e.g.
*
* ```sh
* $ pulumi import linode:index/placementGroupAssignment:PlacementGroupAssignment my-assignment 1234567,7654321
* ```
*/
class PlacementGroupAssignment extends pulumi.CustomResource {
/**
* Get an existing PlacementGroupAssignment 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 PlacementGroupAssignment(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of PlacementGroupAssignment. 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'] === PlacementGroupAssignment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["compliantOnly"] = state ? state.compliantOnly : undefined;
resourceInputs["linodeId"] = state ? state.linodeId : undefined;
resourceInputs["placementGroupId"] = state ? state.placementGroupId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.linodeId === undefined) && !opts.urn) {
throw new Error("Missing required property 'linodeId'");
}
if ((!args || args.placementGroupId === undefined) && !opts.urn) {
throw new Error("Missing required property 'placementGroupId'");
}
resourceInputs["compliantOnly"] = args ? args.compliantOnly : undefined;
resourceInputs["linodeId"] = args ? args.linodeId : undefined;
resourceInputs["placementGroupId"] = args ? args.placementGroupId : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(PlacementGroupAssignment.__pulumiType, name, resourceInputs, opts);
}
}
exports.PlacementGroupAssignment = PlacementGroupAssignment;
/** @internal */
PlacementGroupAssignment.__pulumiType = 'linode:index/placementGroupAssignment:PlacementGroupAssignment';
//# sourceMappingURL=placementGroupAssignment.js.map
;