@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
208 lines • 8.51 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.GameServerGroup = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an GameLift Game Server Group resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.gamelift.GameServerGroup("example", {
* gameServerGroupName: "example",
* instanceDefinitions: [
* {
* instanceType: "c5.large",
* },
* {
* instanceType: "c5a.large",
* },
* ],
* launchTemplate: {
* id: exampleAwsLaunchTemplate.id,
* },
* maxSize: 1,
* minSize: 1,
* roleArn: exampleAwsIamRole.arn,
* }, {
* dependsOn: [exampleAwsIamRolePolicyAttachment],
* });
* ```
*
* Full usage:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.gamelift.GameServerGroup("example", {
* autoScalingPolicy: {
* estimatedInstanceWarmup: 60,
* targetTrackingConfiguration: {
* targetValue: 75,
* },
* },
* balancingStrategy: "SPOT_ONLY",
* gameServerGroupName: "example",
* gameServerProtectionPolicy: "FULL_PROTECTION",
* instanceDefinitions: [
* {
* instanceType: "c5.large",
* weightedCapacity: "1",
* },
* {
* instanceType: "c5.2xlarge",
* weightedCapacity: "2",
* },
* ],
* launchTemplate: {
* id: exampleAwsLaunchTemplate.id,
* version: "1",
* },
* maxSize: 1,
* minSize: 1,
* roleArn: exampleAwsIamRole.arn,
* tags: {
* Name: "example",
* },
* vpcSubnets: [
* "subnet-12345678",
* "subnet-23456789",
* ],
* }, {
* dependsOn: [exampleAwsIamRolePolicyAttachment],
* });
* ```
*
* ### Example IAM Role for GameLift Game Server Group
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const current = aws.getPartition({});
* const assumeRole = aws.iam.getPolicyDocument({
* statements: [{
* effect: "Allow",
* principals: [{
* type: "Service",
* identifiers: [
* "autoscaling.amazonaws.com",
* "gamelift.amazonaws.com",
* ],
* }],
* actions: ["sts:AssumeRole"],
* }],
* });
* const example = new aws.iam.Role("example", {
* assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
* name: "gamelift-game-server-group-example",
* });
* const exampleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("example", {
* policyArn: current.then(current => `arn:${current.partition}:iam::aws:policy/GameLiftGameServerGroupPolicy`),
* role: example.name,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import GameLift Game Server Group using the `name`. For example:
*
* ```sh
* $ pulumi import aws:gamelift/gameServerGroup:GameServerGroup example example
* ```
*/
class GameServerGroup extends pulumi.CustomResource {
/**
* Get an existing GameServerGroup 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 GameServerGroup(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of GameServerGroup. 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'] === GameServerGroup.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state ? state.arn : undefined;
resourceInputs["autoScalingGroupArn"] = state ? state.autoScalingGroupArn : undefined;
resourceInputs["autoScalingPolicy"] = state ? state.autoScalingPolicy : undefined;
resourceInputs["balancingStrategy"] = state ? state.balancingStrategy : undefined;
resourceInputs["gameServerGroupName"] = state ? state.gameServerGroupName : undefined;
resourceInputs["gameServerProtectionPolicy"] = state ? state.gameServerProtectionPolicy : undefined;
resourceInputs["instanceDefinitions"] = state ? state.instanceDefinitions : undefined;
resourceInputs["launchTemplate"] = state ? state.launchTemplate : undefined;
resourceInputs["maxSize"] = state ? state.maxSize : undefined;
resourceInputs["minSize"] = state ? state.minSize : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["roleArn"] = state ? state.roleArn : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
resourceInputs["vpcSubnets"] = state ? state.vpcSubnets : undefined;
}
else {
const args = argsOrState;
if ((!args || args.gameServerGroupName === undefined) && !opts.urn) {
throw new Error("Missing required property 'gameServerGroupName'");
}
if ((!args || args.instanceDefinitions === undefined) && !opts.urn) {
throw new Error("Missing required property 'instanceDefinitions'");
}
if ((!args || args.launchTemplate === undefined) && !opts.urn) {
throw new Error("Missing required property 'launchTemplate'");
}
if ((!args || args.maxSize === undefined) && !opts.urn) {
throw new Error("Missing required property 'maxSize'");
}
if ((!args || args.minSize === undefined) && !opts.urn) {
throw new Error("Missing required property 'minSize'");
}
if ((!args || args.roleArn === undefined) && !opts.urn) {
throw new Error("Missing required property 'roleArn'");
}
resourceInputs["autoScalingPolicy"] = args ? args.autoScalingPolicy : undefined;
resourceInputs["balancingStrategy"] = args ? args.balancingStrategy : undefined;
resourceInputs["gameServerGroupName"] = args ? args.gameServerGroupName : undefined;
resourceInputs["gameServerProtectionPolicy"] = args ? args.gameServerProtectionPolicy : undefined;
resourceInputs["instanceDefinitions"] = args ? args.instanceDefinitions : undefined;
resourceInputs["launchTemplate"] = args ? args.launchTemplate : undefined;
resourceInputs["maxSize"] = args ? args.maxSize : undefined;
resourceInputs["minSize"] = args ? args.minSize : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["roleArn"] = args ? args.roleArn : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["vpcSubnets"] = args ? args.vpcSubnets : undefined;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["autoScalingGroupArn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(GameServerGroup.__pulumiType, name, resourceInputs, opts);
}
}
exports.GameServerGroup = GameServerGroup;
/** @internal */
GameServerGroup.__pulumiType = 'aws:gamelift/gameServerGroup:GameServerGroup';
//# sourceMappingURL=gameServerGroup.js.map