diff --git a/packages/@aws-cdk/aws-gamelift/README.md b/packages/@aws-cdk/aws-gamelift/README.md index 2c310af40af88..2976e810ad22b 100644 --- a/packages/@aws-cdk/aws-gamelift/README.md +++ b/packages/@aws-cdk/aws-gamelift/README.md @@ -52,6 +52,44 @@ configuration or game server fleet management system. ## GameLift FlexMatch +### Defining a Matchmaking configuration + +FlexMatch is available both as a GameLift game hosting solution (including +Realtime Servers) and as a standalone matchmaking service. To set up a +FlexMatch matchmaker to process matchmaking requests, you have to create a +matchmaking configuration based on a RuleSet. + +More details about matchmaking ruleSet are covered [below](#matchmaking-ruleset). + +There is two types of Matchmaking configuration: + +Through a game session queue system to let FlexMatch forms matches and uses the specified GameLift queue to start a game session for the match. + +```ts +declare const queue: gamelift.GameSessionQueue; +declare const ruleSet: gamelift.MatchmakingRuleSet; + +new gamelift.QueuedMatchmakingConfiguration(this, 'QueuedMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-queued-config-name', + gameSessionQueues: [queue], + ruleSet: ruleSet, +}); +``` + +Or through a standalone version to let FlexMatch forms matches and returns match information in an event. + +```ts +declare const ruleSet: gamelift.MatchmakingRuleSet; + +new gamelift.StandaloneMatchmakingConfiguration(this, 'StandaloneMatchmaking', { + matchmakingConfigurationName: 'test-standalone-config-name', + ruleSet: ruleSet, +}); +``` + + +More details about Game session queue are covered [below](#game-session-queue). + ### Matchmaking RuleSet Every FlexMatch matchmaker must have a rule set. The rule set determines the diff --git a/packages/@aws-cdk/aws-gamelift/lib/index.ts b/packages/@aws-cdk/aws-gamelift/lib/index.ts index 5f7ab5dcec93e..0ed50899e15d2 100644 --- a/packages/@aws-cdk/aws-gamelift/lib/index.ts +++ b/packages/@aws-cdk/aws-gamelift/lib/index.ts @@ -6,6 +6,9 @@ export * from './game-server-group'; export * from './ingress-rule'; export * from './fleet-base'; export * from './build-fleet'; +export * from './matchmaking-configuration'; +export * from './queued-matchmaking-configuration'; +export * from './standalone-matchmaking-configuration'; export * from './game-session-queue'; export * from './matchmaking-ruleset'; export * from './matchmaking-ruleset-body'; diff --git a/packages/@aws-cdk/aws-gamelift/lib/matchmaking-configuration.ts b/packages/@aws-cdk/aws-gamelift/lib/matchmaking-configuration.ts new file mode 100644 index 0000000000000..7d4cee5d60e98 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/lib/matchmaking-configuration.ts @@ -0,0 +1,286 @@ +import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; +import * as sns from '@aws-cdk/aws-sns'; +import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; +import { IMatchmakingRuleSet } from '.'; + +/** + * A set of custom properties for a game session, formatted as key-value pairs. + * These properties are passed to a game server process with a request to start a new game session. + * + * This parameter is not used for Standalone FlexMatch mode. + * + * @see https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html#gamelift-sdk-server-startsession + */ +export interface GameProperty { + /** + * The game property identifier. + */ + readonly key: string; + /** + * The game property value. + */ + readonly value: string; +} + +/** + * Represents a Gamelift matchmaking configuration + */ +export interface IMatchmakingConfiguration extends cdk.IResource { + /** + * The name of the matchmaking configuration. + * + * @attribute + */ + readonly matchmakingConfigurationName: string; + + /** + * The ARN of the matchmaking configuration. + * + * @attribute + */ + readonly matchmakingConfigurationArn: string; + + /** + * The notification target for matchmaking events + * + * @attribute + */ + readonly notificationTarget?: sns.ITopic; + + + /** + * Return the given named metric for this matchmaking configuration. + */ + metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * Matchmaking requests currently being processed or waiting to be processed. + */ + metricCurrentTickets(props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * For matchmaking configurations that require acceptance, the potential matches that were accepted since the last report. + */ + metricMatchesAccepted(props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * Potential matches that were created since the last report. + */ + metricMatchesCreated(props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * Matches that were successfully placed into a game session since the last report. + */ + metricMatchesPlaced(props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * For matchmaking configurations that require acceptance, the potential matches that were rejected by at least one player since the last report. + */ + metricMatchesRejected(props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * Players in matchmaking tickets that were added since the last report. + */ + metricPlayersStarted(props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * For matchmaking requests that were put into a potential match before the last report, + * the amount of time between ticket creation and potential match creation. + * + * Units: seconds + */ + metricTimeToMatch(props?: cloudwatch.MetricOptions): cloudwatch.Metric; +} + +/** + * A full specification of a matchmaking configuration that can be used to import it fluently into the CDK application. + */ +export interface MatchmakingConfigurationAttributes { + /** + * The ARN of the Matchmaking configuration + * + * At least one of `matchmakingConfigurationArn` and `matchmakingConfigurationName` must be provided. + * + * @default derived from `matchmakingConfigurationName`. + */ + readonly matchmakingConfigurationArn?: string; + + /** + * The identifier of the Matchmaking configuration + * + * At least one of `matchmakingConfigurationName` and `matchmakingConfigurationArn` must be provided. + * + * @default derived from `matchmakingConfigurationArn`. + */ + readonly matchmakingConfigurationName?: string; + + /** + * An SNS topic ARN that is set up to receive matchmaking notifications. + * + * @see https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-notification.html + * + * @default no notification target binded to imported ressource + */ + readonly notificationTarget?: sns.ITopic; +} + +/** + * Properties for a new Gamelift matchmaking configuration + */ +export interface MatchmakingConfigurationProps { + + /** + * A unique identifier for the matchmaking configuration. + * This name is used to identify the configuration associated with a matchmaking request or ticket. + */ + readonly matchmakingConfigurationName: string; + + /** + * A human-readable description of the matchmaking configuration. + * + * @default no description is provided + */ + readonly description?: string; + + /** + * A flag that determines whether a match that was created with this configuration must be accepted by the matched players. + * With this option enabled, matchmaking tickets use the status `REQUIRES_ACCEPTANCE` to indicate when a completed potential match is waiting for player acceptance. + * + * @default Acceptance is not required + */ + readonly requireAcceptance?: boolean; + + /** + * The length of time (in seconds) to wait for players to accept a proposed match, if acceptance is required. + * + * @default 300 seconds + */ + readonly acceptanceTimeout?: cdk.Duration; + + /** + * Information to add to all events related to the matchmaking configuration. + * + * @default no custom data added to events + */ + readonly customEventData?: string; + + /** + * An SNS topic ARN that is set up to receive matchmaking notifications. + * + * @see https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-notification.html + * + * @default no notification target + */ + readonly notificationTarget?: sns.ITopic; + + /** + * The maximum duration, that a matchmaking ticket can remain in process before timing out. + * Requests that fail due to timing out can be resubmitted as needed. + * + * @default 300 seconds + */ + readonly requestTimeout?: cdk.Duration; + + /** + * A matchmaking rule set to use with this configuration. + * + * A matchmaking configuration can only use rule sets that are defined in the same Region. + */ + readonly ruleSet: IMatchmakingRuleSet; +} + +/** + * Base class for new and imported GameLift Matchmaking configuration. + */ +export abstract class MatchmakingConfigurationBase extends cdk.Resource implements IMatchmakingConfiguration { + + + /** + * Import an existing matchmaking configuration from its attributes. + */ + static fromMatchmakingConfigurationAttributes(scope: Construct, id: string, attrs: MatchmakingConfigurationAttributes): IMatchmakingConfiguration { + if (!attrs.matchmakingConfigurationName && !attrs.matchmakingConfigurationArn) { + throw new Error('Either matchmakingConfigurationName or matchmakingConfigurationArn must be provided in MatchmakingConfigurationAttributes'); + } + const matchmakingConfigurationName = attrs.matchmakingConfigurationName ?? + cdk.Stack.of(scope).splitArn(attrs.matchmakingConfigurationArn!, cdk.ArnFormat.SLASH_RESOURCE_NAME).resourceName; + + if (!matchmakingConfigurationName) { + throw new Error(`No matchmaking configuration name found in ARN: '${attrs.matchmakingConfigurationArn}'`); + } + + const matchmakingConfigurationArn = attrs.matchmakingConfigurationArn ?? cdk.Stack.of(scope).formatArn({ + service: 'gamelift', + resource: 'matchmakingconfiguration', + resourceName: attrs.matchmakingConfigurationName, + arnFormat: cdk.ArnFormat.SLASH_RESOURCE_NAME, + }); + class Import extends MatchmakingConfigurationBase { + public readonly matchmakingConfigurationName = matchmakingConfigurationName!; + public readonly matchmakingConfigurationArn = matchmakingConfigurationArn; + public readonly notificationTarget = attrs.notificationTarget; + + constructor(s: Construct, i: string) { + super(s, i, { + environmentFromArn: matchmakingConfigurationArn, + }); + } + } + return new Import(scope, id); + } + + /** + * The Identifier of the matchmaking configuration. + */ + public abstract readonly matchmakingConfigurationName: string; + /** + * The ARN of the matchmaking configuration. + */ + public abstract readonly matchmakingConfigurationArn: string; + + /** + * The notification target for matchmaking events + */ + public abstract readonly notificationTarget?: sns.ITopic; + + metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return new cloudwatch.Metric({ + namespace: 'AWS/GameLift', + metricName: metricName, + dimensionsMap: { + MatchmakingConfigurationName: this.matchmakingConfigurationName, + }, + ...props, + }).attachTo(this); + } + + metricCurrentTickets(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.metric('CurrentTickets', props); + } + + metricMatchesAccepted(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.metric('MatchesAccepted', props); + } + + metricMatchesCreated(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.metric('MatchesCreated', props); + } + + metricMatchesPlaced(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.metric('MatchesPlaced', props); + } + + metricMatchesRejected(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.metric('MatchesRejected', props); + } + + metricPlayersStarted(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.metric('PlayersStarted', props); + } + + metricTimeToMatch(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.metric('TimeToMatch', props); + } + +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/lib/matchmaking-ruleset.ts b/packages/@aws-cdk/aws-gamelift/lib/matchmaking-ruleset.ts index eaa500f0f3979..94e3d80313710 100644 --- a/packages/@aws-cdk/aws-gamelift/lib/matchmaking-ruleset.ts +++ b/packages/@aws-cdk/aws-gamelift/lib/matchmaking-ruleset.ts @@ -105,7 +105,7 @@ export abstract class MatchmakingRuleSetBase extends cdk.Resource implements IMa namespace: 'AWS/GameLift', metricName: metricName, dimensionsMap: { - FleetId: this.matchmakingRuleSetName, + MatchmakingRuleSetName: this.matchmakingRuleSetName, }, ...props, }).attachTo(this); diff --git a/packages/@aws-cdk/aws-gamelift/lib/queued-matchmaking-configuration.ts b/packages/@aws-cdk/aws-gamelift/lib/queued-matchmaking-configuration.ts new file mode 100644 index 0000000000000..47350e6111e1a --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/lib/queued-matchmaking-configuration.ts @@ -0,0 +1,220 @@ +import * as iam from '@aws-cdk/aws-iam'; +import * as sns from '@aws-cdk/aws-sns'; +import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; +import { IGameSessionQueue } from './game-session-queue'; +import * as gamelift from './gamelift.generated'; +import { MatchmakingConfigurationProps, GameProperty, MatchmakingConfigurationBase, IMatchmakingConfiguration } from './matchmaking-configuration'; + +/** + * Properties for a new queued matchmaking configuration + */ +export interface QueuedMatchmakingConfigurationProps extends MatchmakingConfigurationProps { +/** + * The number of player slots in a match to keep open for future players. + * For example, if the configuration's rule set specifies a match for a single 12-person team, and the additional player count is set to 2, only 10 players are selected for the match. + * + * @default no additional player slots + */ + readonly additionalPlayerCount?: number; + + /** + * The method used to backfill game sessions that are created with this matchmaking configuration. + * - Choose manual when your game manages backfill requests manually or does not use the match backfill feature. + * - Otherwise backfill is settled to automatic to have GameLift create a `StartMatchBackfill` request whenever a game session has one or more open slots. + * + * @see https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-backfill.html + * + * @default automatic backfill mode + */ + readonly manualBackfillMode?: boolean; + + /** + * A set of custom properties for a game session, formatted as key-value pairs. + * These properties are passed to a game server process with a request to start a new game session. + * + * @see https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html#gamelift-sdk-server-startsession + * + * @default no additional game properties + */ + readonly gameProperties?: GameProperty[]; + + /** + * A set of custom game session properties, formatted as a single string value. + * This data is passed to a game server process with a request to start a new game session. + * + * @see https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html#gamelift-sdk-server-startsession + * + * @default no additional game session data + */ + readonly gameSessionData?: string; + + /** + * Queues are used to start new GameLift-hosted game sessions for matches that are created with this matchmaking configuration. + * + * Queues can be located in any Region. + */ + readonly gameSessionQueues: IGameSessionQueue[]; +} + +/** + * A FlexMatch matchmaker process does the work of building a game match. + * It manages the pool of matchmaking requests received, forms teams for a match, processes and selects players to find the best possible player groups, and initiates the process of placing and starting a game session for the match. + * This topic describes the key aspects of a matchmaker and how to configure one customized for your game. + * + * @see https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-configuration.html + * + * @resource AWS::GameLift::MatchmakingConfiguration + */ +export class QueuedMatchmakingConfiguration extends MatchmakingConfigurationBase { + + /** + * Import an existing matchmaking configuration from its name. + */ + static fromQueuedMatchmakingConfigurationName(scope: Construct, id: string, matchmakingConfigurationName: string): IMatchmakingConfiguration { + return this.fromMatchmakingConfigurationAttributes(scope, id, { matchmakingConfigurationName: matchmakingConfigurationName }); + } + + /** + * Import an existing matchmaking configuration from its ARN. + */ + static fromQueuedMatchmakingConfigurationArn(scope: Construct, id: string, matchmakingConfigurationArn: string): IMatchmakingConfiguration { + return this.fromMatchmakingConfigurationAttributes(scope, id, { matchmakingConfigurationArn: matchmakingConfigurationArn }); + } + + /** + * The name of the matchmaking configuration. + */ + public readonly matchmakingConfigurationName: string; + /** + * The ARN of the matchmaking configuration. + */ + public readonly matchmakingConfigurationArn: string; + /** + * The notification target for matchmaking events + */ + public readonly notificationTarget?: sns.ITopic; + + /** + * A list of game session queue destinations + */ + private readonly gameSessionQueues: IGameSessionQueue[] = []; + + constructor(scope: Construct, id: string, props: QueuedMatchmakingConfigurationProps) { + super(scope, id, { + physicalName: props.matchmakingConfigurationName, + }); + + if (props.matchmakingConfigurationName && !cdk.Token.isUnresolved(props.matchmakingConfigurationName)) { + if (props.matchmakingConfigurationName.length > 128) { + throw new Error(`Matchmaking configuration name can not be longer than 128 characters but has ${props.matchmakingConfigurationName.length} characters.`); + } + + if (!/^[a-zA-Z0-9-\.]+$/.test(props.matchmakingConfigurationName)) { + throw new Error(`Matchmaking configuration name ${props.matchmakingConfigurationName} can contain only letters, numbers, hyphens, back slash or dot with no spaces.`); + } + } + + if (props.description && !cdk.Token.isUnresolved(props.description)) { + if (props.description.length > 1024) { + throw new Error(`Matchmaking configuration description can not be longer than 1024 characters but has ${props.description.length} characters.`); + } + } + + if (props.gameProperties && props.gameProperties.length > 16) { + throw new Error(`The maximum number of game properties allowed in the matchmaking configuration cannot be higher than 16, given ${props.gameProperties.length}`); + } + + if (props.gameSessionData && props.gameSessionData.length > 4096) { + throw new Error(`Matchmaking configuration game session data can not be longer than 4096 characters but has ${props.gameSessionData.length} characters.`); + } + + if (props.customEventData && props.customEventData.length > 256) { + throw new Error(`Matchmaking configuration custom event data can not be longer than 256 characters but has ${props.customEventData.length} characters.`); + } + + if (props.acceptanceTimeout && props.acceptanceTimeout.toSeconds() > 600) { + throw new Error(`Matchmaking configuration acceptance timeout can not exceed 600 seconds, actual ${props.acceptanceTimeout.toSeconds()} seconds.`); + } + + if (props.requestTimeout && props.requestTimeout.toSeconds() > 43200) { + throw new Error(`Matchmaking configuration request timeout can not exceed 43200 seconds, actual ${props.requestTimeout.toSeconds()} seconds.`); + } + + //Notification target + this.notificationTarget = props.notificationTarget; + if (!this.notificationTarget) { + this.notificationTarget = new sns.Topic(this, 'Topic', {}); + } + // Be sure to add the right TopicPolicy to enable gamelift publish action to given topic + const topicPolicy = new sns.TopicPolicy(this, 'TopicPolicy', { + topics: [this.notificationTarget], + }); + topicPolicy.document.addStatements(new iam.PolicyStatement({ + actions: ['sns:Publish'], + principals: [new iam.ServicePrincipal('gamelift.amazonaws.com')], + resources: [this.notificationTarget.topicArn], + })); + + // Add all queues + (props.gameSessionQueues || []).forEach(this.addGameSessionQueue.bind(this)); + + const resource = new gamelift.CfnMatchmakingConfiguration(this, 'Resource', { + name: this.physicalName, + acceptanceRequired: Boolean(props.requireAcceptance), + acceptanceTimeoutSeconds: props.acceptanceTimeout && props.acceptanceTimeout.toSeconds(), + additionalPlayerCount: props.additionalPlayerCount, + backfillMode: props.manualBackfillMode ? 'MANUAL' : 'AUTOMATIC', + customEventData: props.customEventData, + description: props.description, + flexMatchMode: 'WITH_QUEUE', + gameProperties: this.parseGameProperties(props), + gameSessionData: props.gameSessionData, + gameSessionQueueArns: cdk.Lazy.list({ produce: () => this.parseGameSessionQueues() }), + notificationTarget: this.notificationTarget.topicArn, + requestTimeoutSeconds: props.requestTimeout && props.requestTimeout.toSeconds() || cdk.Duration.seconds(300).toSeconds(), + ruleSetName: props.ruleSet.matchmakingRuleSetName, + }); + + this.matchmakingConfigurationName = this.getResourceNameAttribute(resource.ref); + this.matchmakingConfigurationArn = cdk.Stack.of(scope).formatArn({ + service: 'gamelift', + resource: 'matchmakingconfiguration', + resourceName: this.matchmakingConfigurationName, + arnFormat: cdk.ArnFormat.SLASH_RESOURCE_NAME, + }); + } + + /** + * Adds a game session queue destination to the matchmaking configuration. + * + * @param gameSessionQueue A game session queue + */ + public addGameSessionQueue(gameSessionQueue: IGameSessionQueue) { + this.gameSessionQueues.push(gameSessionQueue); + } + + private parseGameSessionQueues(): string[] | undefined { + if (!this.gameSessionQueues || this.gameSessionQueues.length === 0) { + return undefined; + } + + return this.gameSessionQueues.map((queue) => queue.gameSessionQueueArn); + } + + private parseGameProperties(props: QueuedMatchmakingConfigurationProps): gamelift.CfnMatchmakingConfiguration.GamePropertyProperty[] | undefined { + if (!props.gameProperties || props.gameProperties.length === 0) { + return undefined; + } + + return props.gameProperties.map(parseGameProperty); + + function parseGameProperty(gameProperty: GameProperty): gamelift.CfnMatchmakingConfiguration.GamePropertyProperty { + return { + key: gameProperty.key, + value: gameProperty.value, + }; + } + } + +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/lib/standalone-matchmaking-configuration.ts b/packages/@aws-cdk/aws-gamelift/lib/standalone-matchmaking-configuration.ts new file mode 100644 index 0000000000000..6082ae492f9ef --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/lib/standalone-matchmaking-configuration.ts @@ -0,0 +1,119 @@ +import * as iam from '@aws-cdk/aws-iam'; +import * as sns from '@aws-cdk/aws-sns'; +import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; +import * as gamelift from './gamelift.generated'; +import { MatchmakingConfigurationProps, MatchmakingConfigurationBase, IMatchmakingConfiguration } from './matchmaking-configuration'; + +/** + * Properties for a new standalone matchmaking configuration + */ +export interface StandaloneMatchmakingConfigurationProps extends MatchmakingConfigurationProps {} + +/** + * A FlexMatch matchmaker process does the work of building a game match. + * It manages the pool of matchmaking requests received, forms teams for a match, processes and selects players to find the best possible player groups, and initiates the process of placing and starting a game session for the match. + * This topic describes the key aspects of a matchmaker and how to configure one customized for your game. + * + * @see https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-configuration.html + * + * @resource AWS::GameLift::MatchmakingConfiguration + */ +export class StandaloneMatchmakingConfiguration extends MatchmakingConfigurationBase { + + /** + * Import an existing matchmaking configuration from its name. + */ + static fromStandaloneMatchmakingConfigurationName(scope: Construct, id: string, matchmakingConfigurationName: string): IMatchmakingConfiguration { + return this.fromMatchmakingConfigurationAttributes(scope, id, { matchmakingConfigurationName }); + } + + /** + * Import an existing matchmaking configuration from its ARN. + */ + static fromStandaloneMatchmakingConfigurationArn(scope: Construct, id: string, matchmakingConfigurationArn: string): IMatchmakingConfiguration { + return this.fromMatchmakingConfigurationAttributes(scope, id, { matchmakingConfigurationArn }); + } + + /** + * The Identifier of the matchmaking configuration. + */ + public readonly matchmakingConfigurationName: string; + /** + * The ARN of the matchmaking configuration. + */ + public readonly matchmakingConfigurationArn: string; + /** + * The notification target for matchmaking events + */ + public readonly notificationTarget?: sns.ITopic; + + constructor(scope: Construct, id: string, props: StandaloneMatchmakingConfigurationProps) { + super(scope, id, { + physicalName: props.matchmakingConfigurationName, + }); + + if (props.matchmakingConfigurationName && !cdk.Token.isUnresolved(props.matchmakingConfigurationName)) { + if (props.matchmakingConfigurationName.length > 128) { + throw new Error(`Matchmaking configuration name can not be longer than 128 characters but has ${props.matchmakingConfigurationName.length} characters.`); + } + + if (!/^[a-zA-Z0-9-\.]+$/.test(props.matchmakingConfigurationName)) { + throw new Error(`Matchmaking configuration name ${props.matchmakingConfigurationName} can contain only letters, numbers, hyphens, back slash or dot with no spaces.`); + } + } + + if (props.description && !cdk.Token.isUnresolved(props.description)) { + if (props.description.length > 1024) { + throw new Error(`Matchmaking configuration description can not be longer than 1024 characters but has ${props.description.length} characters.`); + } + } + + if (props.customEventData && props.customEventData.length > 256) { + throw new Error(`Matchmaking configuration custom event data can not be longer than 256 characters but has ${props.customEventData.length} characters.`); + } + + if (props.acceptanceTimeout && props.acceptanceTimeout.toSeconds() > 600) { + throw new Error(`Matchmaking configuration acceptance timeout can not exceed 600 seconds, actual ${props.acceptanceTimeout.toSeconds()} seconds.`); + } + + if (props.requestTimeout && props.requestTimeout.toSeconds() > 43200) { + throw new Error(`Matchmaking configuration request timeout can not exceed 43200 seconds, actual ${props.requestTimeout.toSeconds()} seconds.`); + } + + //Notification target + this.notificationTarget = props.notificationTarget; + if (!this.notificationTarget) { + this.notificationTarget = new sns.Topic(this, 'Topic', {}); + } + // Be sure to add the right TopicPolicy to enable gamelift publish action to given topic + const topicPolicy = new sns.TopicPolicy(this, 'TopicPolicy', { + topics: [this.notificationTarget], + }); + topicPolicy.document.addStatements(new iam.PolicyStatement({ + actions: ['sns:Publish'], + principals: [new iam.ServicePrincipal('gamelift.amazonaws.com')], + resources: [this.notificationTarget.topicArn], + })); + + const resource = new gamelift.CfnMatchmakingConfiguration(this, 'Resource', { + name: this.physicalName, + acceptanceRequired: Boolean(props.requireAcceptance), + acceptanceTimeoutSeconds: props.acceptanceTimeout && props.acceptanceTimeout.toSeconds(), + customEventData: props.customEventData, + description: props.description, + flexMatchMode: 'STANDALONE', + notificationTarget: this.notificationTarget.topicArn, + requestTimeoutSeconds: props.requestTimeout && props.requestTimeout.toSeconds() || cdk.Duration.seconds(300).toSeconds(), + ruleSetName: props.ruleSet.matchmakingRuleSetName, + }); + + this.matchmakingConfigurationName = this.getResourceNameAttribute(resource.ref); + this.matchmakingConfigurationArn = cdk.Stack.of(scope).formatArn({ + service: 'gamelift', + resource: 'matchmakingconfiguration', + resourceName: this.matchmakingConfigurationName, + arnFormat: cdk.ArnFormat.SLASH_RESOURCE_NAME, + }); + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90.assets.json b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90.assets.json new file mode 100644 index 0000000000000..7f13d593ae9c1 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90.assets.json @@ -0,0 +1,19 @@ +{ + "version": "22.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90.template.json b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/TestApplicationServer b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/TestApplicationServer new file mode 100755 index 0000000000000..a4f885388c109 Binary files /dev/null and b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/TestApplicationServer differ diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/install.sh b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/install.sh new file mode 100755 index 0000000000000..1ef448e39373c --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/install.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# make sure the gameserver is executable +/usr/bin/chmod +x /local/game/TestApplicationServer +exit 0 diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/aws-gamelift-queued-matchmaking-configuration.assets.json b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/aws-gamelift-queued-matchmaking-configuration.assets.json new file mode 100644 index 0000000000000..07a53ab6739aa --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/aws-gamelift-queued-matchmaking-configuration.assets.json @@ -0,0 +1,32 @@ +{ + "version": "22.0.0", + "files": { + "b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37": { + "source": { + "path": "asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "1b0d8d0db3da2b2fdabb9d8f394c65e95befb7f2a283179ccfd11289a1954afc": { + "source": { + "path": "aws-gamelift-queued-matchmaking-configuration.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "1b0d8d0db3da2b2fdabb9d8f394c65e95befb7f2a283179ccfd11289a1954afc.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/aws-gamelift-queued-matchmaking-configuration.template.json b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/aws-gamelift-queued-matchmaking-configuration.template.json new file mode 100644 index 0000000000000..c4a35f2de509c --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/aws-gamelift-queued-matchmaking-configuration.template.json @@ -0,0 +1,331 @@ +{ + "Resources": { + "QueuedMatchmakingConfiguration84BDFE18": { + "Type": "AWS::GameLift::MatchmakingRuleSet", + "Properties": { + "Name": "my-test-ruleset", + "RuleSetBody": "{\"name\":\"three_team_game\",\"ruleLanguageVersion\":\"1.0\",\"playerAttributes\":[{\"name\":\"skill\",\"type\":\"number\",\"default\":10},{\"name\":\"character\",\"type\":\"string_list\",\"default\":[\"peasant\"]}],\"teams\":[{\"name\":\"trio\",\"minPlayers\":3,\"maxPlayers\":5,\"quantity\":3}],\"rules\":[{\"name\":\"FairTeamSkill\",\"description\":\"The average skill of players in each team is within 10 points from the average skill of players in the match\",\"type\":\"distance\",\"measurements\":[\"avg(teams[*].players.attributes[skill])\"],\"referenceValue\":\"avg(flatten(teams[*].players.attributes[skill]))\",\"maxDistance\":10},{\"name\":\"CloseTeamSizes\",\"description\":\"Only launch a game when the team sizes are within 1 of each other. e.g. 3 v 3 v 4 is okay, but not 3 v 5 v 5\",\"type\":\"distance\",\"measurements\":[\"max(count(teams[*].players))\"],\"referenceValue\":\"min(count(teams[*].players))\",\"maxDistance\":1},{\"name\":\"OverallMedicLimit\",\"description\":\"Don't allow more than 5 medics in the game\",\"type\":\"collection\",\"measurements\":[\"flatten(teams[*].players.attributes[character])\"],\"operation\":\"contains\",\"referenceValue\":\"medic\",\"maxCount\":5},{\"name\":\"FastConnection\",\"description\":\"Prefer matches with fast player connections first\",\"type\":\"latency\",\"maxLatency\":50}],\"expansions\":[{\"target\":\"rules[FastConnection].maxLatency\",\"steps\":[{\"waitTimeSeconds\":10,\"value\":100},{\"waitTimeSeconds\":20,\"value\":150}]}]}" + } + }, + "BuildServiceRole1F57E904": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "gamelift.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "BuildServiceRoleDefaultPolicyCB7101C6": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetObject", + "s3:GetObjectVersion" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "/b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "BuildServiceRoleDefaultPolicyCB7101C6", + "Roles": [ + { + "Ref": "BuildServiceRole1F57E904" + } + ] + } + }, + "Build45A36621": { + "Type": "AWS::GameLift::Build", + "Properties": { + "OperatingSystem": "AMAZON_LINUX_2", + "StorageLocation": { + "Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "Key": "b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip", + "RoleArn": { + "Fn::GetAtt": [ + "BuildServiceRole1F57E904", + "Arn" + ] + } + } + }, + "DependsOn": [ + "BuildServiceRoleDefaultPolicyCB7101C6", + "BuildServiceRole1F57E904" + ] + }, + "BuildFleetServiceRole32D49FB4": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": [ + "ec2.amazonaws.com", + "gamelift.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + } + } + }, + "BuildFleet027ED403": { + "Type": "AWS::GameLift::Fleet", + "Properties": { + "BuildId": { + "Ref": "Build45A36621" + }, + "CertificateConfiguration": { + "CertificateType": "DISABLED" + }, + "EC2InboundPermissions": [ + { + "FromPort": 1935, + "IpRange": "0.0.0.0/0", + "Protocol": "TCP", + "ToPort": 1935 + } + ], + "EC2InstanceType": "c5.large", + "FleetType": "ON_DEMAND", + "InstanceRoleARN": { + "Fn::GetAtt": [ + "BuildFleetServiceRole32D49FB4", + "Arn" + ] + }, + "MaxSize": 1, + "MinSize": 0, + "Name": "test-fleet", + "NewGameSessionProtectionPolicy": "NoProtection", + "RuntimeConfiguration": { + "GameSessionActivationTimeoutSeconds": 300, + "MaxConcurrentGameSessionActivations": 1, + "ServerProcesses": [ + { + "ConcurrentExecutions": 1, + "LaunchPath": "/local/game/TestApplicationServer", + "Parameters": "port:1935 gameSessionLengthSeconds:20" + } + ] + } + } + }, + "MyGameSessionQueue1A15CE31": { + "Type": "AWS::GameLift::GameSessionQueue", + "Properties": { + "Name": "test-gameSessionQueue", + "Destinations": [ + { + "DestinationArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":gamelift:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":fleet/", + { + "Ref": "BuildFleet027ED403" + } + ] + ] + } + } + ] + } + }, + "MyQueuedMatchmakingConfigurationTopicBAC3E679": { + "Type": "AWS::SNS::Topic" + }, + "MyQueuedMatchmakingConfigurationTopicPolicy17A129EA": { + "Type": "AWS::SNS::TopicPolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "sns:Publish", + "Effect": "Allow", + "Principal": { + "Service": "gamelift.amazonaws.com" + }, + "Resource": { + "Ref": "MyQueuedMatchmakingConfigurationTopicBAC3E679" + }, + "Sid": "0" + } + ], + "Version": "2012-10-17" + }, + "Topics": [ + { + "Ref": "MyQueuedMatchmakingConfigurationTopicBAC3E679" + } + ] + } + }, + "MyQueuedMatchmakingConfiguration94A9FD4E": { + "Type": "AWS::GameLift::MatchmakingConfiguration", + "Properties": { + "AcceptanceRequired": true, + "Name": "test-config-name", + "RequestTimeoutSeconds": 30, + "RuleSetName": { + "Ref": "QueuedMatchmakingConfiguration84BDFE18" + }, + "AcceptanceTimeoutSeconds": 30, + "AdditionalPlayerCount": 3, + "BackfillMode": "MANUAL", + "CustomEventData": "event-data", + "Description": "test description", + "FlexMatchMode": "WITH_QUEUE", + "GameProperties": [ + { + "Key": "test-key", + "Value": "test-value" + } + ], + "GameSessionData": "test-session-data", + "GameSessionQueueArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":gamelift:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":gamesessionqueue/", + { + "Ref": "MyGameSessionQueue1A15CE31" + } + ] + ] + } + ], + "NotificationTarget": { + "Ref": "MyQueuedMatchmakingConfigurationTopicBAC3E679" + } + } + } + }, + "Outputs": { + "MatchmakingConfigurationArn": { + "Value": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":gamelift:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":matchmakingconfiguration/", + { + "Ref": "MyQueuedMatchmakingConfiguration94A9FD4E" + } + ] + ] + } + }, + "MatchmakingConfigurationName": { + "Value": { + "Ref": "MyQueuedMatchmakingConfiguration94A9FD4E" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/cdk.out b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/cdk.out new file mode 100644 index 0000000000000..145739f539580 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"22.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/integ.json b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/integ.json new file mode 100644 index 0000000000000..a6fe9d9311923 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "22.0.0", + "testCases": { + "QueuedMatchmakingConfiguration/DefaultTest": { + "stacks": [ + "aws-gamelift-queued-matchmaking-configuration" + ], + "assertionStack": "QueuedMatchmakingConfiguration/DefaultTest/DeployAssert", + "assertionStackName": "QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/manifest.json b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/manifest.json new file mode 100644 index 0000000000000..1649bfe3d175d --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/manifest.json @@ -0,0 +1,177 @@ +{ + "version": "22.0.0", + "artifacts": { + "aws-gamelift-queued-matchmaking-configuration.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-gamelift-queued-matchmaking-configuration.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-gamelift-queued-matchmaking-configuration": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-gamelift-queued-matchmaking-configuration.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/1b0d8d0db3da2b2fdabb9d8f394c65e95befb7f2a283179ccfd11289a1954afc.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-gamelift-queued-matchmaking-configuration.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-gamelift-queued-matchmaking-configuration.assets" + ], + "metadata": { + "/aws-gamelift-queued-matchmaking-configuration/QueuedMatchmakingConfiguration/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueuedMatchmakingConfiguration84BDFE18" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/Build/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "BuildServiceRole1F57E904" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/Build/ServiceRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "BuildServiceRoleDefaultPolicyCB7101C6" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/Build/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Build45A36621" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/BuildFleet/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "BuildFleetServiceRole32D49FB4" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/BuildFleet/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "BuildFleet027ED403" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/MyGameSessionQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyGameSessionQueue1A15CE31" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/MyQueuedMatchmakingConfiguration/Topic/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyQueuedMatchmakingConfigurationTopicBAC3E679" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/MyQueuedMatchmakingConfiguration/TopicPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyQueuedMatchmakingConfigurationTopicPolicy17A129EA" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/MyQueuedMatchmakingConfiguration/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyQueuedMatchmakingConfiguration94A9FD4E" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/MatchmakingConfigurationArn": [ + { + "type": "aws:cdk:logicalId", + "data": "MatchmakingConfigurationArn" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/MatchmakingConfigurationName": [ + { + "type": "aws:cdk:logicalId", + "data": "MatchmakingConfigurationName" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-gamelift-queued-matchmaking-configuration/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-gamelift-queued-matchmaking-configuration" + }, + "QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "QueuedMatchmakingConfigurationDefaultTestDeployAssert8FBBBB90.assets" + ], + "metadata": { + "/QueuedMatchmakingConfiguration/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/QueuedMatchmakingConfiguration/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "QueuedMatchmakingConfiguration/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/tree.json b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/tree.json new file mode 100644 index 0000000000000..862e4214304f0 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.js.snapshot/tree.json @@ -0,0 +1,605 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-gamelift-queued-matchmaking-configuration": { + "id": "aws-gamelift-queued-matchmaking-configuration", + "path": "aws-gamelift-queued-matchmaking-configuration", + "children": { + "QueuedMatchmakingConfiguration": { + "id": "QueuedMatchmakingConfiguration", + "path": "aws-gamelift-queued-matchmaking-configuration/QueuedMatchmakingConfiguration", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-gamelift-queued-matchmaking-configuration/QueuedMatchmakingConfiguration/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::GameLift::MatchmakingRuleSet", + "aws:cdk:cloudformation:props": { + "name": "my-test-ruleset", + "ruleSetBody": "{\"name\":\"three_team_game\",\"ruleLanguageVersion\":\"1.0\",\"playerAttributes\":[{\"name\":\"skill\",\"type\":\"number\",\"default\":10},{\"name\":\"character\",\"type\":\"string_list\",\"default\":[\"peasant\"]}],\"teams\":[{\"name\":\"trio\",\"minPlayers\":3,\"maxPlayers\":5,\"quantity\":3}],\"rules\":[{\"name\":\"FairTeamSkill\",\"description\":\"The average skill of players in each team is within 10 points from the average skill of players in the match\",\"type\":\"distance\",\"measurements\":[\"avg(teams[*].players.attributes[skill])\"],\"referenceValue\":\"avg(flatten(teams[*].players.attributes[skill]))\",\"maxDistance\":10},{\"name\":\"CloseTeamSizes\",\"description\":\"Only launch a game when the team sizes are within 1 of each other. e.g. 3 v 3 v 4 is okay, but not 3 v 5 v 5\",\"type\":\"distance\",\"measurements\":[\"max(count(teams[*].players))\"],\"referenceValue\":\"min(count(teams[*].players))\",\"maxDistance\":1},{\"name\":\"OverallMedicLimit\",\"description\":\"Don't allow more than 5 medics in the game\",\"type\":\"collection\",\"measurements\":[\"flatten(teams[*].players.attributes[character])\"],\"operation\":\"contains\",\"referenceValue\":\"medic\",\"maxCount\":5},{\"name\":\"FastConnection\",\"description\":\"Prefer matches with fast player connections first\",\"type\":\"latency\",\"maxLatency\":50}],\"expansions\":[{\"target\":\"rules[FastConnection].maxLatency\",\"steps\":[{\"waitTimeSeconds\":10,\"value\":100},{\"waitTimeSeconds\":20,\"value\":150}]}]}" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.CfnMatchmakingRuleSet", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.MatchmakingRuleSet", + "version": "0.0.0" + } + }, + "Build": { + "id": "Build", + "path": "aws-gamelift-queued-matchmaking-configuration/Build", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "aws-gamelift-queued-matchmaking-configuration/Build/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "aws-gamelift-queued-matchmaking-configuration/Build/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-gamelift-queued-matchmaking-configuration/Build/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "gamelift.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-gamelift-queued-matchmaking-configuration/Build/ServiceRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-gamelift-queued-matchmaking-configuration/Build/ServiceRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetObject", + "s3:GetObjectVersion" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "/b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "BuildServiceRoleDefaultPolicyCB7101C6", + "roles": [ + { + "Ref": "BuildServiceRole1F57E904" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Content": { + "id": "Content", + "path": "aws-gamelift-queued-matchmaking-configuration/Build/Content", + "children": { + "Stage": { + "id": "Stage", + "path": "aws-gamelift-queued-matchmaking-configuration/Build/Content/Stage", + "constructInfo": { + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "aws-gamelift-queued-matchmaking-configuration/Build/Content/AssetBucket", + "constructInfo": { + "fqn": "@aws-cdk/aws-s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-s3-assets.Asset", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "aws-gamelift-queued-matchmaking-configuration/Build/AssetBucket", + "constructInfo": { + "fqn": "@aws-cdk/aws-s3.BucketBase", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-gamelift-queued-matchmaking-configuration/Build/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::GameLift::Build", + "aws:cdk:cloudformation:props": { + "operatingSystem": "AMAZON_LINUX_2", + "storageLocation": { + "bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "key": "b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip", + "roleArn": { + "Fn::GetAtt": [ + "BuildServiceRole1F57E904", + "Arn" + ] + } + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.CfnBuild", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.Build", + "version": "0.0.0" + } + }, + "BuildFleet": { + "id": "BuildFleet", + "path": "aws-gamelift-queued-matchmaking-configuration/BuildFleet", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "aws-gamelift-queued-matchmaking-configuration/BuildFleet/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "aws-gamelift-queued-matchmaking-configuration/BuildFleet/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-gamelift-queued-matchmaking-configuration/BuildFleet/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": [ + "ec2.amazonaws.com", + "gamelift.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-gamelift-queued-matchmaking-configuration/BuildFleet/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::GameLift::Fleet", + "aws:cdk:cloudformation:props": { + "buildId": { + "Ref": "Build45A36621" + }, + "certificateConfiguration": { + "certificateType": "DISABLED" + }, + "ec2InboundPermissions": [ + { + "protocol": "TCP", + "fromPort": 1935, + "toPort": 1935, + "ipRange": "0.0.0.0/0" + } + ], + "ec2InstanceType": "c5.large", + "fleetType": "ON_DEMAND", + "instanceRoleArn": { + "Fn::GetAtt": [ + "BuildFleetServiceRole32D49FB4", + "Arn" + ] + }, + "maxSize": 1, + "minSize": 0, + "name": "test-fleet", + "newGameSessionProtectionPolicy": "NoProtection", + "runtimeConfiguration": { + "gameSessionActivationTimeoutSeconds": 300, + "maxConcurrentGameSessionActivations": 1, + "serverProcesses": [ + { + "parameters": "port:1935 gameSessionLengthSeconds:20", + "launchPath": "/local/game/TestApplicationServer", + "concurrentExecutions": 1 + } + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.CfnFleet", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.BuildFleet", + "version": "0.0.0" + } + }, + "MyGameSessionQueue": { + "id": "MyGameSessionQueue", + "path": "aws-gamelift-queued-matchmaking-configuration/MyGameSessionQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-gamelift-queued-matchmaking-configuration/MyGameSessionQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::GameLift::GameSessionQueue", + "aws:cdk:cloudformation:props": { + "name": "test-gameSessionQueue", + "destinations": [ + { + "destinationArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":gamelift:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":fleet/", + { + "Ref": "BuildFleet027ED403" + } + ] + ] + } + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.CfnGameSessionQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.GameSessionQueue", + "version": "0.0.0" + } + }, + "MyQueuedMatchmakingConfiguration": { + "id": "MyQueuedMatchmakingConfiguration", + "path": "aws-gamelift-queued-matchmaking-configuration/MyQueuedMatchmakingConfiguration", + "children": { + "Topic": { + "id": "Topic", + "path": "aws-gamelift-queued-matchmaking-configuration/MyQueuedMatchmakingConfiguration/Topic", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-gamelift-queued-matchmaking-configuration/MyQueuedMatchmakingConfiguration/Topic/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SNS::Topic", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-sns.CfnTopic", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-sns.Topic", + "version": "0.0.0" + } + }, + "TopicPolicy": { + "id": "TopicPolicy", + "path": "aws-gamelift-queued-matchmaking-configuration/MyQueuedMatchmakingConfiguration/TopicPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-gamelift-queued-matchmaking-configuration/MyQueuedMatchmakingConfiguration/TopicPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SNS::TopicPolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "sns:Publish", + "Effect": "Allow", + "Principal": { + "Service": "gamelift.amazonaws.com" + }, + "Resource": { + "Ref": "MyQueuedMatchmakingConfigurationTopicBAC3E679" + }, + "Sid": "0" + } + ], + "Version": "2012-10-17" + }, + "topics": [ + { + "Ref": "MyQueuedMatchmakingConfigurationTopicBAC3E679" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-sns.CfnTopicPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-sns.TopicPolicy", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-gamelift-queued-matchmaking-configuration/MyQueuedMatchmakingConfiguration/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::GameLift::MatchmakingConfiguration", + "aws:cdk:cloudformation:props": { + "acceptanceRequired": true, + "name": "test-config-name", + "requestTimeoutSeconds": 30, + "ruleSetName": { + "Ref": "QueuedMatchmakingConfiguration84BDFE18" + }, + "acceptanceTimeoutSeconds": 30, + "additionalPlayerCount": 3, + "backfillMode": "MANUAL", + "customEventData": "event-data", + "description": "test description", + "flexMatchMode": "WITH_QUEUE", + "gameProperties": [ + { + "key": "test-key", + "value": "test-value" + } + ], + "gameSessionData": "test-session-data", + "gameSessionQueueArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":gamelift:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":gamesessionqueue/", + { + "Ref": "MyGameSessionQueue1A15CE31" + } + ] + ] + } + ], + "notificationTarget": { + "Ref": "MyQueuedMatchmakingConfigurationTopicBAC3E679" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.CfnMatchmakingConfiguration", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.QueuedMatchmakingConfiguration", + "version": "0.0.0" + } + }, + "MatchmakingConfigurationArn": { + "id": "MatchmakingConfigurationArn", + "path": "aws-gamelift-queued-matchmaking-configuration/MatchmakingConfigurationArn", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "MatchmakingConfigurationName": { + "id": "MatchmakingConfigurationName", + "path": "aws-gamelift-queued-matchmaking-configuration/MatchmakingConfigurationName", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-gamelift-queued-matchmaking-configuration/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-gamelift-queued-matchmaking-configuration/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "QueuedMatchmakingConfiguration": { + "id": "QueuedMatchmakingConfiguration", + "path": "QueuedMatchmakingConfiguration", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "QueuedMatchmakingConfiguration/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "QueuedMatchmakingConfiguration/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.168" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "QueuedMatchmakingConfiguration/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "QueuedMatchmakingConfiguration/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "QueuedMatchmakingConfiguration/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.168" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.ts b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.ts new file mode 100644 index 0000000000000..188504d762b32 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.queued-matchmaking-configuration.ts @@ -0,0 +1,77 @@ +import * as path from 'path'; +import * as ec2 from '@aws-cdk/aws-ec2'; +import * as cdk from '@aws-cdk/core'; +import { CfnOutput } from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; +import { Construct } from 'constructs'; +import * as gamelift from '../lib'; + +class TestStack extends cdk.Stack { + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + const ruleSet = new gamelift.MatchmakingRuleSet(this, 'QueuedMatchmakingConfiguration', { + matchmakingRuleSetName: 'my-test-ruleset', + content: gamelift.RuleSetContent.fromJsonFile(path.join(__dirname, 'my-ruleset/ruleset.json')), + }); + + const build = new gamelift.Build(this, 'Build', { + content: gamelift.Content.fromAsset(path.join(__dirname, 'my-game-build')), + operatingSystem: gamelift.OperatingSystem.AMAZON_LINUX_2, + }); + + const fleet = new gamelift.BuildFleet(this, 'BuildFleet', { + fleetName: 'test-fleet', + content: build, + ingressRules: [{ + source: gamelift.Peer.anyIpv4(), + port: gamelift.Port.tcp(1935), + }], + instanceType: ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE), + runtimeConfiguration: { + gameSessionActivationTimeout: cdk.Duration.seconds(300), + maxConcurrentGameSessionActivations: 1, + serverProcesses: [{ + launchPath: '/local/game/TestApplicationServer', + parameters: 'port:1935 gameSessionLengthSeconds:20', + concurrentExecutions: 1, + }], + }, + }); + + const queue = new gamelift.GameSessionQueue(this, 'MyGameSessionQueue', { + gameSessionQueueName: 'test-gameSessionQueue', + destinations: [fleet], + }); + + const matchmakingConfiguration = new gamelift.QueuedMatchmakingConfiguration(this, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + gameSessionQueues: [queue], + ruleSet: ruleSet, + customEventData: 'event-data', + gameProperties: [{ + key: 'test-key', + value: 'test-value', + }], + gameSessionData: 'test-session-data', + manualBackfillMode: true, + additionalPlayerCount: 3, + description: 'test description', + requestTimeout: cdk.Duration.seconds(30), + requireAcceptance: true, + acceptanceTimeout: cdk.Duration.seconds(30), + }); + + new CfnOutput(this, 'MatchmakingConfigurationArn', { value: matchmakingConfiguration.matchmakingConfigurationArn }); + new CfnOutput(this, 'MatchmakingConfigurationName', { value: matchmakingConfiguration.matchmakingConfigurationName }); + } +} + +// Beginning of the test suite +const app = new cdk.App(); +const stack = new TestStack(app, 'aws-gamelift-queued-matchmaking-configuration'); +new IntegTest(app, 'QueuedMatchmakingConfiguration', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/BuildDefaultTestDeployAssert0688841C.assets.json b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/BuildDefaultTestDeployAssert0688841C.assets.json new file mode 100644 index 0000000000000..b35a218c4d89e --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/BuildDefaultTestDeployAssert0688841C.assets.json @@ -0,0 +1,19 @@ +{ + "version": "22.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "BuildDefaultTestDeployAssert0688841C.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/BuildDefaultTestDeployAssert0688841C.template.json b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/BuildDefaultTestDeployAssert0688841C.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/BuildDefaultTestDeployAssert0688841C.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF.assets.json b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF.assets.json new file mode 100644 index 0000000000000..4db197163e1e4 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF.assets.json @@ -0,0 +1,19 @@ +{ + "version": "22.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF.template.json b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/aws-gamelift-standalone-matchmaking-configuration.assets.json b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/aws-gamelift-standalone-matchmaking-configuration.assets.json new file mode 100644 index 0000000000000..f58831fcf91f8 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/aws-gamelift-standalone-matchmaking-configuration.assets.json @@ -0,0 +1,19 @@ +{ + "version": "22.0.0", + "files": { + "49f6e7e838beb118afcdc5a5082ed92c402292f42c290c4ac272b74e6f3a48a7": { + "source": { + "path": "aws-gamelift-standalone-matchmaking-configuration.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "49f6e7e838beb118afcdc5a5082ed92c402292f42c290c4ac272b74e6f3a48a7.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/aws-gamelift-standalone-matchmaking-configuration.template.json b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/aws-gamelift-standalone-matchmaking-configuration.template.json new file mode 100644 index 0000000000000..de063fa4353be --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/aws-gamelift-standalone-matchmaking-configuration.template.json @@ -0,0 +1,124 @@ +{ + "Resources": { + "StandaloneMatchmakingConfigurationC77F3149": { + "Type": "AWS::GameLift::MatchmakingRuleSet", + "Properties": { + "Name": "my-test-ruleset", + "RuleSetBody": "{\"name\":\"three_team_game\",\"ruleLanguageVersion\":\"1.0\",\"playerAttributes\":[{\"name\":\"skill\",\"type\":\"number\",\"default\":10},{\"name\":\"character\",\"type\":\"string_list\",\"default\":[\"peasant\"]}],\"teams\":[{\"name\":\"trio\",\"minPlayers\":3,\"maxPlayers\":5,\"quantity\":3}],\"rules\":[{\"name\":\"FairTeamSkill\",\"description\":\"The average skill of players in each team is within 10 points from the average skill of players in the match\",\"type\":\"distance\",\"measurements\":[\"avg(teams[*].players.attributes[skill])\"],\"referenceValue\":\"avg(flatten(teams[*].players.attributes[skill]))\",\"maxDistance\":10},{\"name\":\"CloseTeamSizes\",\"description\":\"Only launch a game when the team sizes are within 1 of each other. e.g. 3 v 3 v 4 is okay, but not 3 v 5 v 5\",\"type\":\"distance\",\"measurements\":[\"max(count(teams[*].players))\"],\"referenceValue\":\"min(count(teams[*].players))\",\"maxDistance\":1},{\"name\":\"OverallMedicLimit\",\"description\":\"Don't allow more than 5 medics in the game\",\"type\":\"collection\",\"measurements\":[\"flatten(teams[*].players.attributes[character])\"],\"operation\":\"contains\",\"referenceValue\":\"medic\",\"maxCount\":5},{\"name\":\"FastConnection\",\"description\":\"Prefer matches with fast player connections first\",\"type\":\"latency\",\"maxLatency\":50}],\"expansions\":[{\"target\":\"rules[FastConnection].maxLatency\",\"steps\":[{\"waitTimeSeconds\":10,\"value\":100},{\"waitTimeSeconds\":20,\"value\":150}]}]}" + } + }, + "MyStandaloneMatchmakingConfigurationTopicDEF24815": { + "Type": "AWS::SNS::Topic" + }, + "MyStandaloneMatchmakingConfigurationTopicPolicy9FA21BCE": { + "Type": "AWS::SNS::TopicPolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "sns:Publish", + "Effect": "Allow", + "Principal": { + "Service": "gamelift.amazonaws.com" + }, + "Resource": { + "Ref": "MyStandaloneMatchmakingConfigurationTopicDEF24815" + }, + "Sid": "0" + } + ], + "Version": "2012-10-17" + }, + "Topics": [ + { + "Ref": "MyStandaloneMatchmakingConfigurationTopicDEF24815" + } + ] + } + }, + "MyStandaloneMatchmakingConfiguration01AA1DFD": { + "Type": "AWS::GameLift::MatchmakingConfiguration", + "Properties": { + "AcceptanceRequired": true, + "Name": "test-config-name", + "RequestTimeoutSeconds": 30, + "RuleSetName": { + "Ref": "StandaloneMatchmakingConfigurationC77F3149" + }, + "AcceptanceTimeoutSeconds": 30, + "CustomEventData": "event-data", + "Description": "test description", + "FlexMatchMode": "STANDALONE", + "NotificationTarget": { + "Ref": "MyStandaloneMatchmakingConfigurationTopicDEF24815" + } + } + } + }, + "Outputs": { + "MatchmakingConfigurationArn": { + "Value": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":gamelift:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":matchmakingconfiguration/", + { + "Ref": "MyStandaloneMatchmakingConfiguration01AA1DFD" + } + ] + ] + } + }, + "MatchmakingConfigurationName": { + "Value": { + "Ref": "MyStandaloneMatchmakingConfiguration01AA1DFD" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/cdk.out b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/cdk.out new file mode 100644 index 0000000000000..145739f539580 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"22.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/integ.json b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/integ.json new file mode 100644 index 0000000000000..e9b1edbe67274 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "22.0.0", + "testCases": { + "StandaloneMatchmakingConfiguration/DefaultTest": { + "stacks": [ + "aws-gamelift-standalone-matchmaking-configuration" + ], + "assertionStack": "StandaloneMatchmakingConfiguration/DefaultTest/DeployAssert", + "assertionStackName": "StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/manifest.json b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/manifest.json new file mode 100644 index 0000000000000..2781c7c60fb0d --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/manifest.json @@ -0,0 +1,141 @@ +{ + "version": "22.0.0", + "artifacts": { + "aws-gamelift-standalone-matchmaking-configuration.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-gamelift-standalone-matchmaking-configuration.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-gamelift-standalone-matchmaking-configuration": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-gamelift-standalone-matchmaking-configuration.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/49f6e7e838beb118afcdc5a5082ed92c402292f42c290c4ac272b74e6f3a48a7.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-gamelift-standalone-matchmaking-configuration.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-gamelift-standalone-matchmaking-configuration.assets" + ], + "metadata": { + "/aws-gamelift-standalone-matchmaking-configuration/StandaloneMatchmakingConfiguration/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "StandaloneMatchmakingConfigurationC77F3149" + } + ], + "/aws-gamelift-standalone-matchmaking-configuration/MyStandaloneMatchmakingConfiguration/Topic/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyStandaloneMatchmakingConfigurationTopicDEF24815" + } + ], + "/aws-gamelift-standalone-matchmaking-configuration/MyStandaloneMatchmakingConfiguration/TopicPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyStandaloneMatchmakingConfigurationTopicPolicy9FA21BCE" + } + ], + "/aws-gamelift-standalone-matchmaking-configuration/MyStandaloneMatchmakingConfiguration/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyStandaloneMatchmakingConfiguration01AA1DFD" + } + ], + "/aws-gamelift-standalone-matchmaking-configuration/MatchmakingConfigurationArn": [ + { + "type": "aws:cdk:logicalId", + "data": "MatchmakingConfigurationArn" + } + ], + "/aws-gamelift-standalone-matchmaking-configuration/MatchmakingConfigurationName": [ + { + "type": "aws:cdk:logicalId", + "data": "MatchmakingConfigurationName" + } + ], + "/aws-gamelift-standalone-matchmaking-configuration/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-gamelift-standalone-matchmaking-configuration/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-gamelift-standalone-matchmaking-configuration" + }, + "StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "StandaloneMatchmakingConfigurationDefaultTestDeployAssertAA4E73AF.assets" + ], + "metadata": { + "/StandaloneMatchmakingConfiguration/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/StandaloneMatchmakingConfiguration/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "StandaloneMatchmakingConfiguration/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/tree.json b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/tree.json new file mode 100644 index 0000000000000..589b8332065e4 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.js.snapshot/tree.json @@ -0,0 +1,244 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-gamelift-standalone-matchmaking-configuration": { + "id": "aws-gamelift-standalone-matchmaking-configuration", + "path": "aws-gamelift-standalone-matchmaking-configuration", + "children": { + "StandaloneMatchmakingConfiguration": { + "id": "StandaloneMatchmakingConfiguration", + "path": "aws-gamelift-standalone-matchmaking-configuration/StandaloneMatchmakingConfiguration", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-gamelift-standalone-matchmaking-configuration/StandaloneMatchmakingConfiguration/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::GameLift::MatchmakingRuleSet", + "aws:cdk:cloudformation:props": { + "name": "my-test-ruleset", + "ruleSetBody": "{\"name\":\"three_team_game\",\"ruleLanguageVersion\":\"1.0\",\"playerAttributes\":[{\"name\":\"skill\",\"type\":\"number\",\"default\":10},{\"name\":\"character\",\"type\":\"string_list\",\"default\":[\"peasant\"]}],\"teams\":[{\"name\":\"trio\",\"minPlayers\":3,\"maxPlayers\":5,\"quantity\":3}],\"rules\":[{\"name\":\"FairTeamSkill\",\"description\":\"The average skill of players in each team is within 10 points from the average skill of players in the match\",\"type\":\"distance\",\"measurements\":[\"avg(teams[*].players.attributes[skill])\"],\"referenceValue\":\"avg(flatten(teams[*].players.attributes[skill]))\",\"maxDistance\":10},{\"name\":\"CloseTeamSizes\",\"description\":\"Only launch a game when the team sizes are within 1 of each other. e.g. 3 v 3 v 4 is okay, but not 3 v 5 v 5\",\"type\":\"distance\",\"measurements\":[\"max(count(teams[*].players))\"],\"referenceValue\":\"min(count(teams[*].players))\",\"maxDistance\":1},{\"name\":\"OverallMedicLimit\",\"description\":\"Don't allow more than 5 medics in the game\",\"type\":\"collection\",\"measurements\":[\"flatten(teams[*].players.attributes[character])\"],\"operation\":\"contains\",\"referenceValue\":\"medic\",\"maxCount\":5},{\"name\":\"FastConnection\",\"description\":\"Prefer matches with fast player connections first\",\"type\":\"latency\",\"maxLatency\":50}],\"expansions\":[{\"target\":\"rules[FastConnection].maxLatency\",\"steps\":[{\"waitTimeSeconds\":10,\"value\":100},{\"waitTimeSeconds\":20,\"value\":150}]}]}" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.CfnMatchmakingRuleSet", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.MatchmakingRuleSet", + "version": "0.0.0" + } + }, + "MyStandaloneMatchmakingConfiguration": { + "id": "MyStandaloneMatchmakingConfiguration", + "path": "aws-gamelift-standalone-matchmaking-configuration/MyStandaloneMatchmakingConfiguration", + "children": { + "Topic": { + "id": "Topic", + "path": "aws-gamelift-standalone-matchmaking-configuration/MyStandaloneMatchmakingConfiguration/Topic", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-gamelift-standalone-matchmaking-configuration/MyStandaloneMatchmakingConfiguration/Topic/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SNS::Topic", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-sns.CfnTopic", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-sns.Topic", + "version": "0.0.0" + } + }, + "TopicPolicy": { + "id": "TopicPolicy", + "path": "aws-gamelift-standalone-matchmaking-configuration/MyStandaloneMatchmakingConfiguration/TopicPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-gamelift-standalone-matchmaking-configuration/MyStandaloneMatchmakingConfiguration/TopicPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SNS::TopicPolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "sns:Publish", + "Effect": "Allow", + "Principal": { + "Service": "gamelift.amazonaws.com" + }, + "Resource": { + "Ref": "MyStandaloneMatchmakingConfigurationTopicDEF24815" + }, + "Sid": "0" + } + ], + "Version": "2012-10-17" + }, + "topics": [ + { + "Ref": "MyStandaloneMatchmakingConfigurationTopicDEF24815" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-sns.CfnTopicPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-sns.TopicPolicy", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-gamelift-standalone-matchmaking-configuration/MyStandaloneMatchmakingConfiguration/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::GameLift::MatchmakingConfiguration", + "aws:cdk:cloudformation:props": { + "acceptanceRequired": true, + "name": "test-config-name", + "requestTimeoutSeconds": 30, + "ruleSetName": { + "Ref": "StandaloneMatchmakingConfigurationC77F3149" + }, + "acceptanceTimeoutSeconds": 30, + "customEventData": "event-data", + "description": "test description", + "flexMatchMode": "STANDALONE", + "notificationTarget": { + "Ref": "MyStandaloneMatchmakingConfigurationTopicDEF24815" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.CfnMatchmakingConfiguration", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.StandaloneMatchmakingConfiguration", + "version": "0.0.0" + } + }, + "MatchmakingConfigurationArn": { + "id": "MatchmakingConfigurationArn", + "path": "aws-gamelift-standalone-matchmaking-configuration/MatchmakingConfigurationArn", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "MatchmakingConfigurationName": { + "id": "MatchmakingConfigurationName", + "path": "aws-gamelift-standalone-matchmaking-configuration/MatchmakingConfigurationName", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-gamelift-standalone-matchmaking-configuration/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-gamelift-standalone-matchmaking-configuration/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "StandaloneMatchmakingConfiguration": { + "id": "StandaloneMatchmakingConfiguration", + "path": "StandaloneMatchmakingConfiguration", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "StandaloneMatchmakingConfiguration/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "StandaloneMatchmakingConfiguration/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.168" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "StandaloneMatchmakingConfiguration/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "StandaloneMatchmakingConfiguration/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "StandaloneMatchmakingConfiguration/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.168" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.ts b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.ts new file mode 100644 index 0000000000000..c62c694d5c8b5 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.standalone-matchmaking-configuration.ts @@ -0,0 +1,39 @@ +import * as path from 'path'; +import * as cdk from '@aws-cdk/core'; +import { CfnOutput } from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; +import { Construct } from 'constructs'; +import * as gamelift from '../lib'; + +class TestStack extends cdk.Stack { + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + const ruleSet = new gamelift.MatchmakingRuleSet(this, 'StandaloneMatchmakingConfiguration', { + matchmakingRuleSetName: 'my-test-ruleset', + content: gamelift.RuleSetContent.fromJsonFile(path.join(__dirname, 'my-ruleset/ruleset.json')), + }); + + const matchmakingConfiguration = new gamelift.StandaloneMatchmakingConfiguration(this, 'MyStandaloneMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + ruleSet: ruleSet, + customEventData: 'event-data', + description: 'test description', + requestTimeout: cdk.Duration.seconds(30), + requireAcceptance: true, + acceptanceTimeout: cdk.Duration.seconds(30), + }); + + new CfnOutput(this, 'MatchmakingConfigurationArn', { value: matchmakingConfiguration.matchmakingConfigurationArn }); + new CfnOutput(this, 'MatchmakingConfigurationName', { value: matchmakingConfiguration.matchmakingConfigurationName }); + } +} + +// Beginning of the test suite +const app = new cdk.App(); +const stack = new TestStack(app, 'aws-gamelift-standalone-matchmaking-configuration'); +new IntegTest(app, 'StandaloneMatchmakingConfiguration', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-gamelift/test/matchmaking-ruleset.test.ts b/packages/@aws-cdk/aws-gamelift/test/matchmaking-ruleset.test.ts index f04acc0467403..1797fec9ed334 100644 --- a/packages/@aws-cdk/aws-gamelift/test/matchmaking-ruleset.test.ts +++ b/packages/@aws-cdk/aws-gamelift/test/matchmaking-ruleset.test.ts @@ -1,4 +1,5 @@ import { Template } from '@aws-cdk/assertions'; +import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import * as cdk from '@aws-cdk/core'; import * as gamelift from '../lib'; @@ -49,6 +50,64 @@ describe('MatchmakingRuleSet', () => { }); }); + describe('metric methods provide a Metric with configured and attached properties', () => { + let stack: cdk.Stack; + const ruleSetBody = JSON.stringify('{}'); + let ruleSet: gamelift.MatchmakingRuleSet; + + beforeEach(() => { + stack = new cdk.Stack(undefined, undefined, { env: { account: '000000000000', region: 'us-west-1' } }); + ruleSet = new gamelift.MatchmakingRuleSet(stack, 'MyMatchmakingRuleSet', { + matchmakingRuleSetName: 'test-ruleSet', + content: gamelift.RuleSetContent.fromInline(ruleSetBody), + }); + }); + + test('metric', () => { + const metric = ruleSet.metric('RuleEvaluationsPassed'); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'RuleEvaluationsPassed', + dimensions: { + MatchmakingRuleSetName: ruleSet.matchmakingRuleSetName, + }, + }); + }); + + test('RuleEvaluationsPassed', () => { + const metric = ruleSet.metricRuleEvaluationsPassed(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'RuleEvaluationsPassed', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingRuleSetName: ruleSet.matchmakingRuleSetName, + }, + }); + }); + + test('RuleEvaluationsFailed', () => { + const metric = ruleSet.metricRuleEvaluationsFailed(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'RuleEvaluationsFailed', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingRuleSetName: ruleSet.matchmakingRuleSetName, + }, + }); + }); + }); + describe('test import methods', () => { test('MatchmakingRuleSet.fromMatchmakingRuleSetArn', () => { // GIVEN diff --git a/packages/@aws-cdk/aws-gamelift/test/queued-matchmaking-configuration.test.ts b/packages/@aws-cdk/aws-gamelift/test/queued-matchmaking-configuration.test.ts new file mode 100644 index 0000000000000..c59fde395c8fc --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/queued-matchmaking-configuration.test.ts @@ -0,0 +1,531 @@ +import { Template } from '@aws-cdk/assertions'; +import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; +import * as cdk from '@aws-cdk/core'; +import { Duration } from '@aws-cdk/core'; +import * as gamelift from '../lib'; + +describe('queuedMatchmakingConfiguration', () => { + + describe('new', () => { + let stack: cdk.Stack; + const ruleSetBody = JSON.stringify('{}'); + let gameSessionQueue: gamelift.GameSessionQueueBase; + let ruleSet: gamelift.MatchmakingRuleSet; + + beforeEach(() => { + stack = new cdk.Stack(); + gameSessionQueue = new gamelift.GameSessionQueue(stack, 'MyGameSessionQueue', { + gameSessionQueueName: 'test-queue-name', + destinations: [], + }); + ruleSet = new gamelift.MatchmakingRuleSet(stack, 'MyMatchmakingRuleSet', { + matchmakingRuleSetName: 'test-ruleSet', + content: gamelift.RuleSetContent.fromInline(ruleSetBody), + }); + }); + + test('default QueuedMatchmakingConfiguration', () => { + new gamelift.QueuedMatchmakingConfiguration(stack, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + gameSessionQueues: [gameSessionQueue], + ruleSet: ruleSet, + }); + + Template.fromStack(stack).hasResource('AWS::GameLift::MatchmakingConfiguration', { + Properties: { + Name: 'test-config-name', + NotificationTarget: { Ref: 'MyQueuedMatchmakingConfigurationTopicBAC3E679' }, + FlexMatchMode: 'WITH_QUEUE', + BackfillMode: 'AUTOMATIC', + AcceptanceRequired: false, + RequestTimeoutSeconds: 300, + RuleSetName: { Ref: 'MyMatchmakingRuleSet41F295C4' }, + GameSessionQueueArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':gamelift:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':gamesessionqueue/', + { + Ref: 'MyGameSessionQueue1A15CE31', + }, + ], + ], + }, + ], + }, + }); + }); + + test('add game session queue', () => { + const gameSessionQueue2 = new gamelift.GameSessionQueue(stack, 'MyGameSessionQueue2', { + gameSessionQueueName: 'test-queue-name-2', + destinations: [], + }); + + const matchmakingConfiguration = new gamelift.QueuedMatchmakingConfiguration(stack, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + gameSessionQueues: [gameSessionQueue], + ruleSet: ruleSet, + }); + + matchmakingConfiguration.addGameSessionQueue(gameSessionQueue2); + + Template.fromStack(stack).hasResource('AWS::GameLift::MatchmakingConfiguration', { + Properties: { + Name: 'test-config-name', + NotificationTarget: { Ref: 'MyQueuedMatchmakingConfigurationTopicBAC3E679' }, + FlexMatchMode: 'WITH_QUEUE', + BackfillMode: 'AUTOMATIC', + AcceptanceRequired: false, + RequestTimeoutSeconds: 300, + RuleSetName: { Ref: 'MyMatchmakingRuleSet41F295C4' }, + GameSessionQueueArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':gamelift:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':gamesessionqueue/', + { + Ref: 'MyGameSessionQueue1A15CE31', + }, + ], + ], + }, + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':gamelift:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':gamesessionqueue/', + { + Ref: 'MyGameSessionQueue2EED85BF6', + }, + ], + ], + }, + ], + }, + }); + }); + + test('with all properties', () => { + new gamelift.QueuedMatchmakingConfiguration(stack, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-queuedMatchmakingConfiguration', + gameSessionQueues: [gameSessionQueue], + ruleSet: ruleSet, + customEventData: 'event-data', + gameProperties: [{ + key: 'test-key', + value: 'test-value', + }], + gameSessionData: 'test-session-data', + manualBackfillMode: true, + additionalPlayerCount: 3, + description: 'test description', + requestTimeout: cdk.Duration.seconds(30), + requireAcceptance: true, + acceptanceTimeout: cdk.Duration.seconds(30), + }); + + Template.fromStack(stack).hasResource('AWS::GameLift::MatchmakingConfiguration', { + Properties: { + Name: 'test-queuedMatchmakingConfiguration', + NotificationTarget: { Ref: 'MyQueuedMatchmakingConfigurationTopicBAC3E679' }, + FlexMatchMode: 'WITH_QUEUE', + BackfillMode: 'MANUAL', + AcceptanceRequired: true, + RequestTimeoutSeconds: 30, + RuleSetName: { Ref: 'MyMatchmakingRuleSet41F295C4' }, + AcceptanceTimeoutSeconds: 30, + AdditionalPlayerCount: 3, + GameSessionData: 'test-session-data', + Description: 'test description', + GameProperties: [ + { + Key: 'test-key', + Value: 'test-value', + }, + ], + GameSessionQueueArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':gamelift:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':gamesessionqueue/', + { + Ref: 'MyGameSessionQueue1A15CE31', + }, + ], + ], + }, + ], + }, + }); + }); + + test('with an incorrect name', () => { + let incorrectName = ''; + for (let i = 0; i < 129; i++) { + incorrectName += 'A'; + } + + expect(() => new gamelift.QueuedMatchmakingConfiguration(stack, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: incorrectName, + gameSessionQueues: [gameSessionQueue], + ruleSet: ruleSet, + })).toThrow(/Matchmaking configuration name can not be longer than 128 characters but has 129 characters./); + }); + + test('with an incorrect name format', () => { + let incorrectName = 'test with space'; + + expect(() => new gamelift.QueuedMatchmakingConfiguration(stack, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: incorrectName, + gameSessionQueues: [gameSessionQueue], + ruleSet: ruleSet, + })).toThrow(/Matchmaking configuration name test with space can contain only letters, numbers, hyphens, back slash or dot with no spaces./); + }); + + test('with an incorrect description', () => { + let incorrectDescription = ''; + for (let i = 0; i < 1025; i++) { + incorrectDescription += 'A'; + } + + expect(() => new gamelift.QueuedMatchmakingConfiguration(stack, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + gameSessionQueues: [gameSessionQueue], + ruleSet: ruleSet, + description: incorrectDescription, + })).toThrow(/Matchmaking configuration description can not be longer than 1024 characters but has 1025 characters./); + }); + + test('with an incorrect number of game properties', () => { + let incorrectField: gamelift.GameProperty[] = []; + for (let i = 0; i < 17; i++) { + incorrectField.push({ + key: 'test', + value: 'test', + }); + } + + expect(() => new gamelift.QueuedMatchmakingConfiguration(stack, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + gameSessionQueues: [gameSessionQueue], + ruleSet: ruleSet, + gameProperties: incorrectField, + })).toThrow(/The maximum number of game properties allowed in the matchmaking configuration cannot be higher than 16, given 17/); + }); + + test('with an incorrect game session data length', () => { + let incorrectField: string = ''; + for (let i = 0; i < 4097; i++) { + incorrectField += 'A'; + } + + expect(() => new gamelift.QueuedMatchmakingConfiguration(stack, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + gameSessionQueues: [gameSessionQueue], + ruleSet: ruleSet, + gameSessionData: incorrectField, + })).toThrow(/Matchmaking configuration game session data can not be longer than 4096 characters but has 4097 characters./); + }); + + test('with an incorrect custom event data length', () => { + let incorrectField: string = ''; + for (let i = 0; i < 257; i++) { + incorrectField += 'A'; + } + + expect(() => new gamelift.QueuedMatchmakingConfiguration(stack, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + gameSessionQueues: [gameSessionQueue], + ruleSet: ruleSet, + customEventData: incorrectField, + })).toThrow(/Matchmaking configuration custom event data can not be longer than 256 characters but has 257 characters./); + }); + + test('with an incorrect acceptance timeout', () => { + expect(() => new gamelift.QueuedMatchmakingConfiguration(stack, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + gameSessionQueues: [gameSessionQueue], + ruleSet: ruleSet, + acceptanceTimeout: Duration.seconds(700), + })).toThrow(/Matchmaking configuration acceptance timeout can not exceed 600 seconds, actual 700 seconds./); + }); + + test('with an incorrect request timeout', () => { + expect(() => new gamelift.QueuedMatchmakingConfiguration(stack, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + gameSessionQueues: [gameSessionQueue], + ruleSet: ruleSet, + requestTimeout: Duration.seconds(43300), + })).toThrow(/Matchmaking configuration request timeout can not exceed 43200 seconds, actual 43300 seconds./); + }); + }); + + describe('metric methods provide a Metric with configured and attached properties', () => { + let stack: cdk.Stack; + const ruleSetBody = JSON.stringify('{}'); + let gameSessionQueue: gamelift.GameSessionQueueBase; + let ruleSet: gamelift.MatchmakingRuleSet; + let queuedMatchmakingConfiguration: gamelift.QueuedMatchmakingConfiguration; + + beforeEach(() => { + stack = new cdk.Stack(undefined, undefined, { env: { account: '000000000000', region: 'us-west-1' } }); + gameSessionQueue = new gamelift.GameSessionQueue(stack, 'MyGameSessionQueue', { + gameSessionQueueName: 'test-queue-name', + destinations: [], + }); + ruleSet = new gamelift.MatchmakingRuleSet(stack, 'MyMatchmakingRuleSet', { + matchmakingRuleSetName: 'test-ruleSet', + content: gamelift.RuleSetContent.fromInline(ruleSetBody), + }); + queuedMatchmakingConfiguration = new gamelift.QueuedMatchmakingConfiguration(stack, 'MyQueuedMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + gameSessionQueues: [gameSessionQueue], + ruleSet: ruleSet, + }); + }); + + test('metric', () => { + const metric = queuedMatchmakingConfiguration.metric('CurrentTickets'); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'CurrentTickets', + dimensions: { + MatchmakingConfigurationName: queuedMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + test('metricPlayersStarted', () => { + const metric = queuedMatchmakingConfiguration.metricPlayersStarted(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'PlayersStarted', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingConfigurationName: queuedMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + test('metricMatchesRejected', () => { + const metric = queuedMatchmakingConfiguration.metricMatchesRejected(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'MatchesRejected', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingConfigurationName: queuedMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + test('metricMatchesPlaced', () => { + const metric = queuedMatchmakingConfiguration.metricMatchesPlaced(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'MatchesPlaced', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingConfigurationName: queuedMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + test('metricMatchesCreated', () => { + const metric = queuedMatchmakingConfiguration.metricMatchesCreated(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'MatchesCreated', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingConfigurationName: queuedMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + test('metricMatchesAccepted', () => { + const metric = queuedMatchmakingConfiguration.metricMatchesAccepted(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'MatchesAccepted', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingConfigurationName: queuedMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + test('metricCurrentTickets', () => { + const metric = queuedMatchmakingConfiguration.metricCurrentTickets(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'CurrentTickets', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingConfigurationName: queuedMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + + }); + + describe('test import methods', () => { + test('QueuedMatchmakingConfiguration.fromQueuedMatchmakingConfigurationArn', () => { + // GIVEN + const stack2 = new cdk.Stack(); + + // WHEN + const imported = gamelift.QueuedMatchmakingConfiguration.fromQueuedMatchmakingConfigurationArn(stack2, 'Imported', 'arn:aws:gamelift:us-east-1:123456789012:matchmakingconfiguration/sample-queuedMatchmakingConfiguration-name'); + + // THEN + expect(imported.matchmakingConfigurationArn).toEqual('arn:aws:gamelift:us-east-1:123456789012:matchmakingconfiguration/sample-queuedMatchmakingConfiguration-name'); + expect(imported.matchmakingConfigurationName).toEqual('sample-queuedMatchmakingConfiguration-name'); + }); + + test('QueuedMatchmakingConfiguration.fromQueuedMatchmakingConfigurationName', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const imported = gamelift.QueuedMatchmakingConfiguration.fromQueuedMatchmakingConfigurationName(stack, 'Imported', 'sample-matchmakingConfiguration-name'); + + // THEN + expect(stack.resolve(imported.matchmakingConfigurationArn)).toStrictEqual({ + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':gamelift:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':matchmakingconfiguration/sample-matchmakingConfiguration-name', + ]], + }); + expect(stack.resolve(imported.matchmakingConfigurationName)).toStrictEqual('sample-matchmakingConfiguration-name'); + }); + }); + + describe('QueuedMatchmakingConfiguration.fromQueuedMatchmakingConfigurationAttributes()', () => { + let stack: cdk.Stack; + const matchmakingConfigurationName = 'matchmakingConfiguration-test-name'; + const matchmakingConfigurationArn = `arn:aws:gamelift:matchmakingConfiguration-region:123456789012:matchmakingconfiguration/${matchmakingConfigurationName}`; + + beforeEach(() => { + const app = new cdk.App(); + stack = new cdk.Stack(app, 'Base', { + env: { account: '111111111111', region: 'stack-region' }, + }); + }); + + describe('', () => { + test('with required attrs only', () => { + const importedFleet = gamelift.QueuedMatchmakingConfiguration.fromMatchmakingConfigurationAttributes(stack, 'ImportedQueuedMatchmakingConfiguration', { matchmakingConfigurationArn }); + + expect(importedFleet.matchmakingConfigurationName).toEqual(matchmakingConfigurationName); + expect(importedFleet.matchmakingConfigurationArn).toEqual(matchmakingConfigurationArn); + expect(importedFleet.env.account).toEqual('123456789012'); + expect(importedFleet.env.region).toEqual('matchmakingConfiguration-region'); + }); + + test('with missing attrs', () => { + expect(() => gamelift.QueuedMatchmakingConfiguration.fromMatchmakingConfigurationAttributes(stack, 'ImportedQueuedMatchmakingConfiguration', { })) + .toThrow(/Either matchmakingConfigurationName or matchmakingConfigurationArn must be provided in MatchmakingConfigurationAttributes/); + }); + + test('with invalid ARN', () => { + expect(() => gamelift.QueuedMatchmakingConfiguration.fromMatchmakingConfigurationAttributes(stack, 'ImportedQueuedMatchmakingConfiguration', { matchmakingConfigurationArn: 'arn:aws:gamelift:matchmakingConfiguration-region:123456789012:matchmakingconfiguration' })) + .toThrow(/No matchmaking configuration name found in ARN: 'arn:aws:gamelift:matchmakingConfiguration-region:123456789012:matchmakingconfiguration'/); + }); + }); + + describe('for an queuedMatchmakingConfiguration in a different account and region', () => { + let queuedMatchmakingConfiguration: gamelift.IMatchmakingConfiguration; + + beforeEach(() => { + queuedMatchmakingConfiguration = gamelift.QueuedMatchmakingConfiguration.fromMatchmakingConfigurationAttributes(stack, 'ImportedQueuedMatchmakingConfiguration', { matchmakingConfigurationArn }); + }); + + test("the queuedMatchmakingConfiguration's region is taken from the ARN", () => { + expect(queuedMatchmakingConfiguration.env.region).toBe('matchmakingConfiguration-region'); + }); + + test("the queuedMatchmakingConfiguration's account is taken from the ARN", () => { + expect(queuedMatchmakingConfiguration.env.account).toBe('123456789012'); + }); + }); + }); +}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/standalone-matchmaking-configuration.test.ts b/packages/@aws-cdk/aws-gamelift/test/standalone-matchmaking-configuration.test.ts new file mode 100644 index 0000000000000..637de61b3f3c8 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/standalone-matchmaking-configuration.test.ts @@ -0,0 +1,334 @@ +import { Template } from '@aws-cdk/assertions'; +import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; +import * as cdk from '@aws-cdk/core'; +import { Duration } from '@aws-cdk/core'; +import * as gamelift from '../lib'; + +describe('standaloneMatchmakingConfiguration', () => { + + describe('new', () => { + let stack: cdk.Stack; + const ruleSetBody = JSON.stringify('{}'); + let ruleSet: gamelift.MatchmakingRuleSet; + + beforeEach(() => { + stack = new cdk.Stack(); + ruleSet = new gamelift.MatchmakingRuleSet(stack, 'MyMatchmakingRuleSet', { + matchmakingRuleSetName: 'test-ruleSet', + content: gamelift.RuleSetContent.fromInline(ruleSetBody), + }); + }); + + test('default StandaloneMatchmakingConfiguration', () => { + new gamelift.StandaloneMatchmakingConfiguration(stack, 'MyStandaloneMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + ruleSet: ruleSet, + }); + + Template.fromStack(stack).hasResource('AWS::GameLift::MatchmakingConfiguration', { + Properties: + { + Name: 'test-config-name', + NotificationTarget: { Ref: 'MyStandaloneMatchmakingConfigurationTopicDEF24815' }, + FlexMatchMode: 'STANDALONE', + AcceptanceRequired: false, + RequestTimeoutSeconds: 300, + RuleSetName: { Ref: 'MyMatchmakingRuleSet41F295C4' }, + }, + }); + }); + + test('with all properties', () => { + new gamelift.StandaloneMatchmakingConfiguration(stack, 'MyStandaloneMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-standaloneMatchmakingConfiguration', + ruleSet: ruleSet, + }); + + Template.fromStack(stack).hasResource('AWS::GameLift::MatchmakingConfiguration', { + Properties: + { + Name: 'test-standaloneMatchmakingConfiguration', + NotificationTarget: { Ref: 'MyStandaloneMatchmakingConfigurationTopicDEF24815' }, + FlexMatchMode: 'STANDALONE', + AcceptanceRequired: false, + RequestTimeoutSeconds: 300, + RuleSetName: { Ref: 'MyMatchmakingRuleSet41F295C4' }, + }, + }); + }); + + test('with an incorrect name', () => { + let incorrectName = ''; + for (let i = 0; i < 129; i++) { + incorrectName += 'A'; + } + + expect(() => new gamelift.StandaloneMatchmakingConfiguration(stack, 'MyStandaloneMatchmakingConfiguration', { + matchmakingConfigurationName: incorrectName, + ruleSet: ruleSet, + })).toThrow(/Matchmaking configuration name can not be longer than 128 characters but has 129 characters./); + }); + + test('with an incorrect name format', () => { + let incorrectName = 'test with space'; + + expect(() => new gamelift.StandaloneMatchmakingConfiguration(stack, 'MyStandaloneMatchmakingConfiguration', { + matchmakingConfigurationName: incorrectName, + ruleSet: ruleSet, + })).toThrow(/Matchmaking configuration name test with space can contain only letters, numbers, hyphens, back slash or dot with no spaces./); + }); + + test('with an incorrect description', () => { + let incorrectDescription = ''; + for (let i = 0; i < 1025; i++) { + incorrectDescription += 'A'; + } + + expect(() => new gamelift.StandaloneMatchmakingConfiguration(stack, 'MyStandaloneMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + ruleSet: ruleSet, + description: incorrectDescription, + })).toThrow(/Matchmaking configuration description can not be longer than 1024 characters but has 1025 characters./); + }); + + test('with an incorrect custom event data length', () => { + let incorrectField: string = ''; + for (let i = 0; i < 257; i++) { + incorrectField += 'A'; + } + + expect(() => new gamelift.StandaloneMatchmakingConfiguration(stack, 'MyStandaloneMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + ruleSet: ruleSet, + customEventData: incorrectField, + })).toThrow(/Matchmaking configuration custom event data can not be longer than 256 characters but has 257 characters./); + }); + + test('with an incorrect acceptance timeout', () => { + expect(() => new gamelift.StandaloneMatchmakingConfiguration(stack, 'MyStandaloneMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + ruleSet: ruleSet, + acceptanceTimeout: Duration.seconds(700), + })).toThrow(/Matchmaking configuration acceptance timeout can not exceed 600 seconds, actual 700 seconds./); + }); + + test('with an incorrect request timeout', () => { + expect(() => new gamelift.StandaloneMatchmakingConfiguration(stack, 'MyStandaloneMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + ruleSet: ruleSet, + requestTimeout: Duration.seconds(43300), + })).toThrow(/Matchmaking configuration request timeout can not exceed 43200 seconds, actual 43300 seconds./); + }); + }); + + describe('metric methods provide a Metric with configured and attached properties', () => { + let stack: cdk.Stack; + const ruleSetBody = JSON.stringify('{}'); + let ruleSet: gamelift.MatchmakingRuleSet; + let standaloneMatchmakingConfiguration: gamelift.StandaloneMatchmakingConfiguration; + + beforeEach(() => { + stack = new cdk.Stack(undefined, undefined, { env: { account: '000000000000', region: 'us-west-1' } }); + ruleSet = new gamelift.MatchmakingRuleSet(stack, 'MyMatchmakingRuleSet', { + matchmakingRuleSetName: 'test-ruleSet', + content: gamelift.RuleSetContent.fromInline(ruleSetBody), + }); + standaloneMatchmakingConfiguration = new gamelift.StandaloneMatchmakingConfiguration(stack, 'MyStandaloneMatchmakingConfiguration', { + matchmakingConfigurationName: 'test-config-name', + ruleSet: ruleSet, + }); + }); + + test('metric', () => { + const metric = standaloneMatchmakingConfiguration.metric('CurrentTickets'); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'CurrentTickets', + dimensions: { + MatchmakingConfigurationName: standaloneMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + test('metricPlayersStarted', () => { + const metric = standaloneMatchmakingConfiguration.metricPlayersStarted(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'PlayersStarted', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingConfigurationName: standaloneMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + test('metricMatchesRejected', () => { + const metric = standaloneMatchmakingConfiguration.metricMatchesRejected(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'MatchesRejected', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingConfigurationName: standaloneMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + test('metricMatchesPlaced', () => { + const metric = standaloneMatchmakingConfiguration.metricMatchesPlaced(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'MatchesPlaced', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingConfigurationName: standaloneMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + test('metricMatchesCreated', () => { + const metric = standaloneMatchmakingConfiguration.metricMatchesCreated(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'MatchesCreated', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingConfigurationName: standaloneMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + test('metricMatchesAccepted', () => { + const metric = standaloneMatchmakingConfiguration.metricMatchesAccepted(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'MatchesAccepted', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingConfigurationName: standaloneMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + test('metricCurrentTickets', () => { + const metric = standaloneMatchmakingConfiguration.metricCurrentTickets(); + + expect(metric).toMatchObject({ + account: stack.account, + region: stack.region, + namespace: 'AWS/GameLift', + metricName: 'CurrentTickets', + statistic: cloudwatch.Stats.AVERAGE, + dimensions: { + MatchmakingConfigurationName: standaloneMatchmakingConfiguration.matchmakingConfigurationName, + }, + }); + }); + + + }); + + describe('test import methods', () => { + test('StandaloneMatchmakingConfiguration.fromStandaloneMatchmakingConfigurationArn', () => { + // GIVEN + const stack2 = new cdk.Stack(); + + // WHEN + const imported = gamelift.StandaloneMatchmakingConfiguration.fromStandaloneMatchmakingConfigurationArn(stack2, 'Imported', 'arn:aws:gamelift:us-east-1:123456789012:matchmakingconfiguration/sample-standaloneMatchmakingConfiguration-name'); + + // THEN + expect(imported.matchmakingConfigurationArn).toEqual('arn:aws:gamelift:us-east-1:123456789012:matchmakingconfiguration/sample-standaloneMatchmakingConfiguration-name'); + expect(imported.matchmakingConfigurationName).toEqual('sample-standaloneMatchmakingConfiguration-name'); + }); + + test('StandaloneMatchmakingConfiguration.fromStandaloneMatchmakingConfigurationName', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const imported = gamelift.StandaloneMatchmakingConfiguration.fromStandaloneMatchmakingConfigurationName(stack, 'Imported', 'sample-matchmakingConfiguration-name'); + + // THEN + expect(stack.resolve(imported.matchmakingConfigurationArn)).toStrictEqual({ + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':gamelift:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':matchmakingconfiguration/sample-matchmakingConfiguration-name', + ]], + }); + expect(stack.resolve(imported.matchmakingConfigurationName)).toStrictEqual('sample-matchmakingConfiguration-name'); + }); + }); + + describe('StandaloneMatchmakingConfiguration.fromStandaloneMatchmakingConfigurationAttributes()', () => { + let stack: cdk.Stack; + const matchmakingConfigurationName = 'matchmakingConfiguration-test-name'; + const matchmakingConfigurationArn = `arn:aws:gamelift:matchmakingConfiguration-region:123456789012:matchmakingconfiguration/${matchmakingConfigurationName}`; + + beforeEach(() => { + const app = new cdk.App(); + stack = new cdk.Stack(app, 'Base', { + env: { account: '111111111111', region: 'stack-region' }, + }); + }); + + describe('', () => { + test('with required attrs only', () => { + const importedFleet = gamelift.StandaloneMatchmakingConfiguration.fromMatchmakingConfigurationAttributes(stack, 'ImportedStandaloneMatchmakingConfiguration', { matchmakingConfigurationArn }); + + expect(importedFleet.matchmakingConfigurationName).toEqual(matchmakingConfigurationName); + expect(importedFleet.matchmakingConfigurationArn).toEqual(matchmakingConfigurationArn); + expect(importedFleet.env.account).toEqual('123456789012'); + expect(importedFleet.env.region).toEqual('matchmakingConfiguration-region'); + }); + + test('with missing attrs', () => { + expect(() => gamelift.StandaloneMatchmakingConfiguration.fromMatchmakingConfigurationAttributes(stack, 'ImportedStandaloneMatchmakingConfiguration', { })) + .toThrow(/Either matchmakingConfigurationName or matchmakingConfigurationArn must be provided in MatchmakingConfigurationAttributes/); + }); + + test('with invalid ARN', () => { + expect(() => gamelift.StandaloneMatchmakingConfiguration.fromMatchmakingConfigurationAttributes(stack, 'ImportedStandaloneMatchmakingConfiguration', { matchmakingConfigurationArn: 'arn:aws:gamelift:matchmakingConfiguration-region:123456789012:matchmakingconfiguration' })) + .toThrow(/No matchmaking configuration name found in ARN: 'arn:aws:gamelift:matchmakingConfiguration-region:123456789012:matchmakingconfiguration'/); + }); + }); + + describe('for an standaloneMatchmakingConfiguration in a different account and region', () => { + let standaloneMatchmakingConfiguration: gamelift.IMatchmakingConfiguration; + + beforeEach(() => { + standaloneMatchmakingConfiguration = gamelift.StandaloneMatchmakingConfiguration.fromMatchmakingConfigurationAttributes(stack, 'ImportedStandaloneMatchmakingConfiguration', { matchmakingConfigurationArn }); + }); + + test("the standaloneMatchmakingConfiguration's region is taken from the ARN", () => { + expect(standaloneMatchmakingConfiguration.env.region).toBe('matchmakingConfiguration-region'); + }); + + test("the standaloneMatchmakingConfiguration's account is taken from the ARN", () => { + expect(standaloneMatchmakingConfiguration.env.account).toBe('123456789012'); + }); + }); + }); +}); \ No newline at end of file