@pulumi/openstack
Version:
A Pulumi package for creating and managing OpenStack cloud resources.
139 lines • 5.25 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");
/**
* Manages a V2 Server Group resource within OpenStack.
*
* ## Example Usage
*
* ### Compute service API version 2.63 or below:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const test_sg = new openstack.compute.ServerGroup("test-sg", {
* name: "my-sg",
* policies: "anti-affinity",
* });
* const test_instance = new openstack.compute.Instance("test-instance", {
* name: "my-instance",
* imageId: "ad091b52-742f-469e-8f3c-fd81cadf0743",
* flavorId: "3",
* schedulerHints: [{
* group: test_sg.id,
* }],
* networks: [{
* name: "my_network",
* }],
* });
* ```
*
* ### Compute service API version 2.64 or above:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const test_sg = new openstack.compute.ServerGroup("test-sg", {
* name: "my-sg",
* policies: "anti-affinity",
* rules: {
* maxServerPerHost: 3,
* },
* });
* const test_instance = new openstack.compute.Instance("test-instance", {
* name: "my-instance",
* imageId: "ad091b52-742f-469e-8f3c-fd81cadf0743",
* flavorId: "3",
* schedulerHints: [{
* group: test_sg.id,
* }],
* networks: [{
* name: "my_network",
* }],
* });
* ```
*
* ## Policies
*
* * `affinity` - All instances/servers launched in this group will be hosted on
* the same compute node.
*
* * `anti-affinity` - All instances/servers launched in this group will be
* hosted on different compute nodes.
*
* * `soft-affinity` - All instances/servers launched in this group will be hosted
* on the same compute node if possible, but if not possible they
* still will be scheduled instead of failure. To use this policy your
* OpenStack environment should support Compute service API 2.15 or above.
*
* * `soft-anti-affinity` - All instances/servers launched in this group will be
* hosted on different compute nodes if possible, but if not possible they
* still will be scheduled instead of failure. To use this policy your
* OpenStack environment should support Compute service API 2.15 or above.
*
* ## Import
*
* Server Groups can be imported using the `id`, e.g.
*
* ```sh
* $ pulumi import openstack:compute/serverGroup:ServerGroup test-sg 1bc30ee9-9d5b-4c30-bdd5-7f1e663f5edf
* ```
*/
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, Object.assign(Object.assign({}, 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["members"] = state ? state.members : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["policies"] = state ? state.policies : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["rules"] = state ? state.rules : undefined;
resourceInputs["valueSpecs"] = state ? state.valueSpecs : undefined;
}
else {
const args = argsOrState;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["policies"] = args ? args.policies : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["rules"] = args ? args.rules : undefined;
resourceInputs["valueSpecs"] = args ? args.valueSpecs : undefined;
resourceInputs["members"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ServerGroup.__pulumiType, name, resourceInputs, opts);
}
}
exports.ServerGroup = ServerGroup;
/** @internal */
ServerGroup.__pulumiType = 'openstack:compute/serverGroup:ServerGroup';
//# sourceMappingURL=serverGroup.js.map