

# C\$1\$1 server SDK 5.x for Amazon GameLift Servers -- Actions
<a name="integration-server-sdk5-cpp-actions"></a>

Use the server SDK 5.x reference to integrate your multiplayer game for hosting with Amazon GameLift Servers. For guidance about the integration process, see [Add Amazon GameLift Servers to your game server with the server SDK](gamelift-sdk-server-api.md).

**Note**  
This topic describes the Amazon GameLift Servers C\$1\$1 API that you can use when you build with the C\$1\$1 Standard Library (`std`). Specifically, this documentation applies to code that you compile with the `-DDGAMELIFT_USE_STD=1` option. 

# C\$1\$1 server SDK 5.x for Amazon GameLift Servers -- Data types
<a name="integration-server-sdk5-cpp-datatypes"></a>

Use the Amazon GameLift Servers C\$1\$1 server SDK 5.x reference to integrate your multiplayer game for hosting with Amazon GameLift Servers. For guidance about the integration process, see [Add Amazon GameLift Servers to your game server with the server SDK](gamelift-sdk-server-api.md).

**Note**  
This topic describes the Amazon GameLift Servers C\$1\$1 API that you can use when you build with the C\$1\$1 Standard Library (`std`). Specifically, this documentation applies to code that you compile with the `-DDGAMELIFT_USE_STD=1` option. 

[C\$1\$1 server SDK 5.x for Amazon GameLift Servers -- Actions](integration-server-sdk5-cpp-actions.md)

**Topics**
+ [LogParameters](#integration-server-sdk5-cpp-dataypes-log)
+ [MetricsParameters](#integration-server-sdk5-cpp-datatypes-metricsparameters)
+ [ProcessParameters](#integration-server-sdk5-cpp-dataypes-process)
+ [UpdateGameSession](#integration-server-sdk5-cpp-dataypes-updategamesession)
+ [GameSession](#integration-server-sdk5-cpp-dataypes-gamesession)
+ [ServerParameters](#integration-server-sdk5-cpp-dataypes-serverparameters)
+ [StartMatchBackfillRequest](#integration-server-sdk5-cpp-dataypes-startmatchbackfillrequest)
+ [Player](#integration-server-sdk5-cpp-dataypes-player)
+ [DescribePlayerSessionsRequest](#integration-server-sdk5-cpp-dataypes-playersessions)
+ [StopMatchBackfillRequest](#integration-server-sdk5-cpp-dataypes-stopmatchbackfillrequest)
+ [AttributeValue](#integration-server-sdk5-cpp-dataypes-attributevalue)
+ [GetFleetRoleCredentialsRequest](#integration-server-sdk5-cpp-dataypes-getfleetrolecredentialsrequest)
+ [AwsLongOutcome](#integration-server-sdk5-cpp-datatypes-awslongoutcome)
+ [AwsStringOutcome](#integration-server-sdk5-cpp-datatypes-awsstringoutcome)
+ [DescribePlayerSessionsOutcome](#integration-server-sdk5-cpp-datatypes-describeplayersessionsoutcome)
+ [DescribePlayerSessionsResult](#integration-server-sdk5-cpp-datatypes-describeplayersessionsresult)
+ [GenericOutcome](#integration-server-sdk5-cpp-datatypes-genericoutcome)
+ [GenericOutcomeCallable](#integration-server-sdk5-cpp-datatypes-genericoutcomecallable)
+ [PlayerSession](#integration-server-sdk5-cpp-datatypes-playersession)
+ [StartMatchBackfillOutcome](#integration-server-sdk5-cpp-datatypes-startmatchbackfilloutcome)
+ [StartMatchBackfillResult](#integration-server-sdk5-cpp-datatypes-startmatchbackfillresult)
+ [GetComputeCertificateOutcome](#integration-server-sdk5-cpp-datatypes-getcomputecertificateoutcome)
+ [GetComputeCertificateResult](#integration-server-sdk5-cpp-datatypes-getcomputecertificateresult)
+ [GetFleetRoleCredentialsOutcome](#integration-server-sdk5-cpp-datatypes-getfleetrolecredentialsoutcome)
+ [GetFleetRoleCredentialsResult](#integration-server-sdk5-cpp-datatypes-getfleetrolecredentialsresult)
+ [InitSDKOutcome](#integration-server-sdk5-cpp-datatypes-initsdkoutcome)
+ [GameLiftError](#integration-server-sdk5-cpp-datatypes-gamelifterror)
+ [Enums](#integration-server-sdk5-cpp-dataypes-enums)

## LogParameters
<a name="integration-server-sdk5-cpp-dataypes-log"></a>

An object identifying files generated during a game session that you want Amazon GameLift Servers to upload and store after the game session ends. The game server provides `LogParameters` to Amazon GameLift Servers as part of a `ProcessParameters` object in a [ProcessReady()](integration-server-sdk5-cpp-actions.md#integration-server-sdk5-cpp-processready) call.


|  |  | 
| --- |--- |
|  **Properties**  | Description | 
| LogPaths |  The list of directory paths to game server log files you want Amazon GameLift Servers to store for future access. The server process generates these files during each game session. You define file paths and names in your game server and store them in the root game build directory.  The log paths must be absolute. For example, if your game build stores game session logs in a path like `MyGame\sessionLogs\`, then the path would be `c:\game\MyGame\sessionLogs` on a Windows instance. **Type:** `std:vector<std::string>` **Required:** No  | 

## MetricsParameters
<a name="integration-server-sdk5-cpp-datatypes-metricsparameters"></a>

Use this data type to configure metrics collection and crash reporting for the game server. The game server communicates `MetricsParameters` to Amazon GameLift Servers in an [InitMetrics()](integration-server-sdk5-cpp-actions.md#integration-server-sdk5-cpp-initmetrics) call.


|  |  | 
| --- |--- |
|  **Properties**  | Description | 
| StatsdHost |  The hostname or IP address of the StatsD server for metrics collection. **Type:** `std::string` **Required:** No  | 
| StatsdPort |  The port number of the StatsD server for metrics collection. **Type:** `int` **Required:** No  | 
| CrashReporterHost |  The hostname or IP address of the crash reporter server. **Type:** `std::string` **Required:** No  | 
| CrashReporterPort |  The port number of the crash reporter server. **Type:** `int` **Required:** No  | 
| FlushIntervalMs |  The interval in milliseconds for flushing metrics data to the server. **Type:** `int` **Required:** No  | 
| MaxPacketSize |  The maximum size in bytes for metrics packets sent to the server. **Type:** `int` **Required:** No  | 

## ProcessParameters
<a name="integration-server-sdk5-cpp-dataypes-process"></a>

This data type contains the set of parameters sent to Amazon GameLift Servers in a [ProcessReady()](integration-server-sdk5-cpp-actions.md#integration-server-sdk5-cpp-processready).


|  |  | 
| --- |--- |
|  **Properties**  | Description | 
| LogParameters | An object with directory paths to files that are generated during a game session. Amazon GameLift Servers copies and stores the files for future access.**Type:** `Aws::GameLift::Server::LogParameters`**Required:** No | 
| OnHealthCheck | The callback function that Amazon GameLift Servers invokes to request a health status report from the server process. Amazon GameLift Servers calls this function every 60 seconds and waits 60 seconds for a response. The server process returns TRUE if healthy, FALSE if not healthy. If no response is returned, Amazon GameLift Servers records the server process as not healthy.**Type:** `std::function<bool()> onHealthCheck`**Required:** No | 
| OnProcessTerminate | The callback function that Amazon GameLift Servers invokes to force the server process to shut down. After calling this function, Amazon GameLift Servers waits 5 minutes for the server process to shut down and respond with a [ProcessEnding()](integration-server-sdk5-cpp-actions.md#integration-server-sdk5-cpp-processending) call before it shuts down the server process.**Type:** `std::function<void()> onProcessTerminate`**Required:** Yes | 
| OnStartGameSession | The callback function that Amazon GameLift Servers invokes to activate a new game session. Amazon GameLift Servers calls this function in response to a client request [CreateGameSession](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_CreateGameSession.html). The callback function passes a [GameSession](#integration-server-sdk5-cpp-dataypes-gamesession) object.**Type:** `const std::function<void(Aws::GameLift::Model::GameSession)> onStartGameSession`**Required:** Yes | 
| OnUpdateGameSession | The callback function that Amazon GameLift Servers invokes to pass an updated game session object to the server process. Amazon GameLift Servers calls this function when a match backfill request has been processed to provide updated matchmaker data. It passes a [GameSession](#integration-server-sdk5-cpp-dataypes-gamesession) object, a status update (updateReason), and the match backfill ticket ID.**Type:** `std::function<void(Aws::GameLift::Server::Model::UpdateGameSession)> onUpdateGameSession`**Required:** No | 
| Port | The port number the server process listens on for new player connections. The value must fall into the port range configured for any fleet deploying this game server build. This port number is included in game session and player session objects, which game sessions use when connecting to a server process.**Type:** `Integer`**Required:** Yes | 

## UpdateGameSession
<a name="integration-server-sdk5-cpp-dataypes-updategamesession"></a>

This data type updates to a game session object, which includes the reason that the game session was updated and the related backfill ticket ID if backfill is used to fill player sessions in the game session.


| Properties | **Description** | 
| --- | --- | 
| GameSession | A [GameSession](#integration-server-sdk5-cpp-dataypes-gamesession) object. The GameSession object contains properties describing a game session. **Type:** `Aws::GameLift::Server::GameSession`**Required:** Yes | 
| UpdateReason | The reason that the game session is being updated.**Type:** `Aws::GameLift::Server::UpdateReason`**Required:** Yes | 
| BackfillTicketId | The ID of the backfill ticket attempting to update the game session.**Type:** `std::string`**Required:** No | 

## GameSession
<a name="integration-server-sdk5-cpp-dataypes-gamesession"></a>

This data type provides details of a game session. 


| Properties | **Description** | 
| --- | --- | 
| GameSessionId |  A unique identifier for the game session. A game session ARN has the following format: `arn:aws:gamelift:<region>::gamesession/<fleet ID>/<custom ID string or idempotency token>`. **Type:** `std::string` **Required**: No  | 
| Name |  A descriptive label of the game session.  **Type:** `std::string` **Required**: No  | 
| FleetId |  A unique identifier for the fleet that the game session is running on. **Type:** `std::string` **Required**: No  | 
| MaximumPlayerSessionCount |  The maximum number of player connections to the game session. **Type:** `int` **Required**: No  | 
| Port |  The port number for the game session. To connect to an Amazon GameLift Servers game server, an app needs both the IP address and port number. **Type:** `in` **Required**: No  | 
| IpAddress |  The IP address of the game session. To connect to an Amazon GameLift Servers game server, an app needs both the IP address and port number. **Type:** `std::string` **Required**: No  | 
| GameSessionData |  A set of custom game session properties, formatted as a single string value.  **Type:** `std::string` **Required**: No  | 
| MatchmakerData |  Information about the matchmaking process that was used to create the game session, in JSON syntax, formatted as a string. In addition to the matchmaking configuration used, it contains data on all players assigned to the match, including player attributes and team assignments. **Type:** `std::string` **Required**: No  | 
| GameProperties |  A set of custom properties for a game session, formatted as key:value pairs. These properties are passed with a request to start a new game session. **Type:** `std :: vector < GameProperty >` **Required**: No  | 
| DnsName |  The DNS identifier assigned to the instance that's running the game session. Values have the following format: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/gameliftservers/latest/developerguide/integration-server-sdk5-cpp-datatypes.html) When connecting to a game session that's running on a TLS-enabled fleet, you must use the DNS name, not the IP address. **Type:** `std::string` **Required**: No  | 

## ServerParameters
<a name="integration-server-sdk5-cpp-dataypes-serverparameters"></a>

Information that a game server process uses to establish a connection with the Amazon GameLift Servers service. Include these parameters when calling [InitSDK()](integration-server-sdk5-cpp-actions.md#integration-server-sdk5-cpp-initsdk-anywhere) only if the game server build will be deployed to an Anywhere fleet or a container fleet without the Amazon GameLift Servers Agent. For all other deployment scenarios, call [InitSDK()](integration-server-sdk5-cpp-actions.md#integration-server-sdk5-cpp-initsdk) without parameters.


| Properties | **Description** | 
| --- | --- | 
| webSocketUrl |  The `GameLiftServerSdkEndpoint` Amazon GameLift Servers returns when you [https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_RegisterCompute.html](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_RegisterCompute.html) for a Amazon GameLift Servers Anywhere compute resource. **Type:** `std::string` **Required**: Yes   | 
| processId |  A unique identifier registered to the server process hosting your game. **Type:** `std::string` **Required**: Yes  | 
| hostId | The HostID is the ComputeName used when you registered your compute. For more information see, [RegisterCompute](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_RegisterCompute.html).**Type:** `std::string`**Required**: Yes | 
| fleetId | The unique identifier of the fleet that the compute is registered to. For more information see, [RegisterCompute](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_RegisterCompute.html).**Type:** `std::string`**Required**: Yes | 
| authToken | The authentication token generated by Amazon GameLift Servers that authenticates your server to Amazon GameLift Servers. For more information see, [GetComputeAuthToken](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_GetComputeAuthToken.html).**Type:** `std::string`**Required**: Yes | 

## StartMatchBackfillRequest
<a name="integration-server-sdk5-cpp-dataypes-startmatchbackfillrequest"></a>

Information used to create a matchmaking backfill request. The game server communicates this information to Amazon GameLift Servers in a [StartMatchBackfill()](integration-server-sdk5-cpp-actions.md#integration-server-sdk5-cpp-startmatchbackfill) call.


| Properties | **Description** | 
| --- | --- | 
| GameSessionArn |  A unique game session identifier. The API operation `[GetGameSessionId](https://docs.aws.amazon.com/gameliftservers/latest/developerguide/integration-server-sdk5-cpp-actions.html#integration-server-sdk5-cpp-getgamesessionid)` returns the identifier in ARN format. **Type:** `std::string` **Required**: Yes  | 
| MatchmakingConfigurationArn |  A unique identifier, in the form of an ARN, for the matchmaker to use for this request. The matchmaker ARN for the original game session is in the game session object in the matchmaker data property. Learn more about matchmaker data in [Work with matchmaker data](https://docs.aws.amazon.com/gameliftservers/latest/flexmatchguide/match-server.html#match-server-data.html). **Type:** `std::string` **Required**: Yes  | 
| Players |  A set of data representing all players who are in the game session. The matchmaker uses this information to search for new players who are good matches for the current players. **Type:** `std::vector<Player>` **Required**: Yes  | 
| TicketId |  A unique identifier for a matchmaking or match backfill request ticket. If you don't provide a value, Amazon GameLift Servers generates one. Use this identifier to track the match backfill ticket status or cancel the request if needed.  **Type:** `std::string` **Required**: No  | 

## Player
<a name="integration-server-sdk5-cpp-dataypes-player"></a>

This data type represents a player in matchmaking. When starting a matchmaking request, a player has a player ID, attributes, and possibly latency data. Amazon GameLift Servers adds team information after a match is made.


| Properties | **Description** | 
| --- | --- | 
| LatencyInMS |  A set of values expressed in milliseconds that indicate the amount of latency that a player experiences when connected to a location.  If this property is used, the player is only matched for locations listed. If a matchmaker has a rule that evaluates player latency, players must report latency to be matched. **Type:** `Dictionary<string,int>` **Required**: No  | 
| PlayerAttributes |  A collection of key:value pairs containing player information for use in matchmaking. Player attribute keys must match the PlayerAttributes used in a matchmaking rule set. For more information about player attributes, see [AttributeValue](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_AttributeValue.html). **Type:** `std::map<std::string,AttributeValue>` **Required**: No  | 
| PlayerId |  A unique identifier for a player. **Type:** `std::string` **Required**: No  | 
| Team |  The name of the team that the player is assigned to in a match. You define team name in the matchmaking rule set. **Type:** `std::string` **Required**: No  | 

## DescribePlayerSessionsRequest
<a name="integration-server-sdk5-cpp-dataypes-playersessions"></a>

An object that specifies which player sessions to retrieve. The server process provides this information with a [DescribePlayerSessions()](integration-server-sdk5-cpp-actions.md#integration-server-sdk5-cpp-describeplayersessions) call to Amazon GameLift Servers.


| Properties | **Description** | 
| --- | --- | 
| GameSessionId |  A unique game session identifier. Use this parameter to request all player sessions for the specified game session.  Game session ID format is `arn:aws:gamelift:<region>::gamesession/fleet-<fleet ID>/<ID string>`. The `GameSessionID` is a custom ID string or a **Type:** `std::string` **Required**: No  | 
| PlayerSessionId |  The unique identifier for a player session. Use this parameter to request a single specific player session. **Type:** `std::string` **Required**: No  | 
| PlayerId |  The unique identifier for a player. Use this parameter to request all player sessions for a specific player. See [Generate player IDs](player-sessions-player-identifiers.md). **Type:** `std::string` **Required**: No  | 
| PlayerSessionStatusFilter |  The player session status to filter results on. Possible player session statuses include: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/gameliftservers/latest/developerguide/integration-server-sdk5-cpp-datatypes.html) **Type:** `std::string` **Required**: No  | 
| NextToken |  The token indicating the start of the next page of results. To specify the start of the result set, don't provide a value. If you provide a player session ID, this parameter is ignored. **Type:** `std::string` **Required**: No  | 
| Limit |  The maximum number of results to return. If you provide a player session ID, this parameter is ignored. **Type:** `int` **Required**: No  | 

## StopMatchBackfillRequest
<a name="integration-server-sdk5-cpp-dataypes-stopmatchbackfillrequest"></a>

Information used to cancel a matchmaking backfill request. The game server communicates this information to Amazon GameLift Servers service in a [StopMatchBackfill()](integration-server-sdk5-cpp-actions.md#integration-server-sdk5-cpp-stopmatchbackfill) call.


| Properties | **Description** | 
| --- | --- | 
| GameSessionArn |  A unique game session identifier of the request being canceled. **Type:** `char[]` **Required**: No  | 
| MatchmakingConfigurationArn |  A unique identifier of the matchmaker this request was sent to. **Type:** `char[]` **Required**: No  | 
| TicketId |  A unique identifier of the backfill request ticket to be canceled. **Type:** `char[]` **Required**: No  | 

## AttributeValue
<a name="integration-server-sdk5-cpp-dataypes-attributevalue"></a>

Use these values in [Player](#integration-server-sdk5-cpp-dataypes-player) attribute key-value pairs. This object lets you specify an attribute value using any of the valid data types: string, number, string array, or data map. Each `AttributeValue` object must use exactly one of the available properties: `S`, `N`, `SL`, or `SDM`.


| Properties | Description | 
| --- | --- | 
| AttrType |  Specifies the type of attribute value. Possible attribute value types include:  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/gameliftservers/latest/developerguide/integration-server-sdk5-cpp-datatypes.html) **Required:** No  | 
| S |  Represents a string attribute value. **Type:** `std::string` **Required:** No  | 
| N |  Represents a numeric attribute value. **Type:** `double` **Required:** No  | 
| SL |  Represents an array of string attribute values. **Type:** `std::vector<std::string>` **Required:** No  | 
| SDM |  Represents a dictionary of string keys and double values. **Type:** `std::map<std::string, double>` **Required:** No  | 

## GetFleetRoleCredentialsRequest
<a name="integration-server-sdk5-cpp-dataypes-getfleetrolecredentialsrequest"></a>

This data type gives the game server limited access to your other AWS resources. For more information see, [Set up an IAM service role for Amazon GameLift Servers](setting-up-role.md).


| Properties | **Description** | 
| --- | --- | 
| RoleArn | The Amazon Resource Name (ARN) of the service role that extends limited access to your AWS resources.**Type:** `std::string`**Required**: No | 
| RoleSessionName | The role session name that you can use to uniquely identify an AWS Security Token Service [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) session. This name is exposed in audit logs such as those in CloudTrail. **Type:** `std::string`  **Required**: No  | 

## AwsLongOutcome
<a name="integration-server-sdk5-cpp-datatypes-awslongoutcome"></a>

This data type results from an action and produces an object with the following properties:


| Properties | Description | 
| --- | --- | 
| Result |  The result of the action. **Type:** `long` **Required:** No  | 
| ResultWithOwnership |   The result of the action, cast as an rvalue, so that the calling code can take ownership of the object.  **Type:** `long&&` **Required**: No  | 
| Success |  Whether the action was successful or not. **Type:** `bool` **Required**: Yes  | 
| Error |  The error that occurred if the action was unsuccessful. **Type:** [GameLiftError](#integration-server-sdk5-cpp-datatypes-gamelifterror) **Required:** No  | 

## AwsStringOutcome
<a name="integration-server-sdk5-cpp-datatypes-awsstringoutcome"></a>

This data type results from an action and produces an object with the following properties:


| Properties | Description | 
| --- | --- | 
| Result |  The result of the action. **Type:** `std::string` **Required:** No  | 
| ResultWithOwnership |   The result of the action, cast as an rvalue, so that the calling code can take ownership of the object.  **Type:** `long&&` **Required**: No  | 
| Success |  Whether the action was successful or not. **Type:** `bool` **Required**: Yes  | 
| Error |  The error that occurred if the action was unsuccessful. **Type:** [GameLiftError](#integration-server-sdk5-cpp-datatypes-gamelifterror) **Required:** No  | 

## DescribePlayerSessionsOutcome
<a name="integration-server-sdk5-cpp-datatypes-describeplayersessionsoutcome"></a>

This data type results from an action and produces an object with the following properties:


| Properties | Description | 
| --- | --- | 
| Result |  The result of the action. **Type:** [DescribePlayerSessionsResult](#integration-server-sdk5-cpp-datatypes-describeplayersessionsresult) **Required:** No   | 
| ResultWithOwnership |   The result of the action, cast as an rvalue, so that the calling code can take ownership of the object.  **Type:** `Aws::GameLift::Server::Model::DescribePlayerSessionsResult&&` **Required**: No  | 
| Success |  Whether the action was successful or not. **Type:** `bool` **Required**: Yes  | 
| Error |  The error that occurred if the action was unsuccessful. **Type:** [GameLiftError](#integration-server-sdk5-cpp-datatypes-gamelifterror) **Required:** No  | 

## DescribePlayerSessionsResult
<a name="integration-server-sdk5-cpp-datatypes-describeplayersessionsresult"></a>

A collection of objects containing properties for each player session that matches the request. 


| Properties | Description | 
| --- | --- | 
| NextToken |  A token that indicates the start of the next sequential page of results. Use the token that is returned with a previous call to this operation. To start at the beginning of the result set, do not specify a value. If a player session ID is specified, this parameter is ignored.  **Type:** `std::string` **Required:** Yes  | 
| PlayerSessions |  **Type:** `IList<PlayerSession>` **Required:**   | 
| ResultWithOwnership |   The result of the action, cast as an rvalue, so that the calling code can take ownership of the object.  **Type:** `std::string&&` **Required**: No  | 
| Success |  Whether the action was successful or not. **Type:** `bool` **Required**: Yes  | 
| Error |  The error that occurred if the action was unsuccessful. **Type:** [GameLiftError](#integration-server-sdk5-cpp-datatypes-gamelifterror) **Required:** No  | 

## GenericOutcome
<a name="integration-server-sdk5-cpp-datatypes-genericoutcome"></a>

This data type results from an action and produces an object with the following properties:


| Properties | Description | 
| --- | --- | 
| Success |  Whether the action was successful or not. **Type:** `bool` **Required**: Yes  | 
| Error |  The error that occurred if the action was unsuccessful. **Type:** [GameLiftError](#integration-server-sdk5-cpp-datatypes-gamelifterror) **Required:** No  | 

## GenericOutcomeCallable
<a name="integration-server-sdk5-cpp-datatypes-genericoutcomecallable"></a>

This data type is an asynchronous generic outcome. It has the following properties: 


| Properties | Description | 
| --- | --- | 
| Success |  Whether the action was successful or not. **Type:** `bool` **Required**: Yes  | 
| Error |  The error that occurred if the action was unsuccessful. **Type:** [GameLiftError](#integration-server-sdk5-cpp-datatypes-gamelifterror) **Required:** No  | 

## PlayerSession
<a name="integration-server-sdk5-cpp-datatypes-playersession"></a>

This data type represents a player session that Amazon GameLift Servers passes to the game server. For more information, see [PlayerSession](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_PlayerSession.html). 


| Properties | Description | 
| --- | --- | 
| CreationTime |  **Type:** `long` **Required:** No  | 
| FleetId |  **Type:** `std::string` **Required:** No  | 
| GameSessionId |  **Type:** `std::string` **Required:** No  | 
| IpAddress |  **Type:** `std::string` **Required:** No  | 
| PlayerData |  **Type:** `std::string` **Required:** No  | 
| PlayerId |  **Type:** `std::string` **Required:** No  | 
| PlayerSessionId |  **Type:** `std::string` **Required:** No  | 
| Port |  **Type:** `int` **Required:** No  | 
| Status |  Player session status to filter results on. When a PlayerSessionId or PlayerId is provided, then the PlayerSessionStatusFilter has no effect on the response.  **Type:** A `PlayerSessionStatus` enum. Possible values include the following:  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/gameliftservers/latest/developerguide/integration-server-sdk5-cpp-datatypes.html) **Required:** No  | 
| TerminationTime |  **Type:** `long` **Required:** No  | 
| DnsName |  **Type:** `std::string` **Required:** No  | 

## StartMatchBackfillOutcome
<a name="integration-server-sdk5-cpp-datatypes-startmatchbackfilloutcome"></a>

This data type results from an action and produces an object with the following properties:


| Properties | Description | 
| --- | --- | 
| Result |  The result of the action. **Type:** [StartMatchBackfillResult](#integration-server-sdk5-cpp-datatypes-startmatchbackfillresult) **Required:** No  | 
| ResultWithOwnership |   The result of the action, cast as an rvalue, so that the calling code can take ownership of the object.  **Type:** `StartMatchBackfillResult&&` **Required**: No  | 
| Success |  Whether the action was successful or not. **Type:** `bool` **Required**: Yes  | 
| Error |  The error that occurred if the action was unsuccessful. **Type:** [GameLiftError](#integration-server-sdk5-cpp-datatypes-gamelifterror) **Required:** No  | 

## StartMatchBackfillResult
<a name="integration-server-sdk5-cpp-datatypes-startmatchbackfillresult"></a>

This data type results from an action and produces an object with the following properties:


| Properties | Description | 
| --- | --- | 
| TicketId |  A unique identifier for a matchmaking ticket. If no ticket ID is specified here, Amazon GameLift Servers will generate one in the form of a UUID. Use this identifier to track the match backfill ticket status and retrieve match results.  **Type:** `std::string` **Required:** No  | 

## GetComputeCertificateOutcome
<a name="integration-server-sdk5-cpp-datatypes-getcomputecertificateoutcome"></a>

This data type results from an action and produces an object with the following properties:


| Properties | Description | 
| --- | --- | 
| Result |  The result of the action. **Type:** [GetComputeCertificateResult](#integration-server-sdk5-cpp-datatypes-getcomputecertificateresult) **Required:** No   | 
| ResultWithOwnership |   The result of the action, cast as an rvalue, so that the calling code can take ownership of the object.  **Type:** `Aws::GameLift::Server::Model::GetComputeCertificateResult&&` **Required**: No  | 
| Success |  Whether the action was successful or not. **Type:** `bool` **Required**: Yes  | 
| Error |  The error that occurred if the action was unsuccessful. **Type:** [GameLiftError](#integration-server-sdk5-cpp-datatypes-gamelifterror) **Required:** No  | 

## GetComputeCertificateResult
<a name="integration-server-sdk5-cpp-datatypes-getcomputecertificateresult"></a>

The path to the TLS certificate on your compute and the compute's host name.


| Properties | Description | 
| --- | --- | 
| CertificatePath |  The path to the TLS certificate on your compute resource. When using an Amazon GameLift Servers managed fleet, this path contains:  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/gameliftservers/latest/developerguide/integration-server-sdk5-cpp-datatypes.html) **Type:** `std::string` **Required:** No  | 
| ComputeName |  The name of your compute resource. **Type:** `std::string` **Required:** No  | 

## GetFleetRoleCredentialsOutcome
<a name="integration-server-sdk5-cpp-datatypes-getfleetrolecredentialsoutcome"></a>

This data type results from an action and produces an object with the following properties:


| Properties | Description | 
| --- | --- | 
| Result |  The result of the action. **Type:** [GetFleetRoleCredentialsResult](#integration-server-sdk5-cpp-datatypes-getfleetrolecredentialsresult) **Required:** No   | 
| ResultWithOwnership |   The result of the action, cast as an rvalue, so that the calling code can take ownership of the object.  **Type:** `Aws::GameLift::Server::Model::GetFleetRoleCredentialsResult` **Required**: No  | 
| Success |  Whether the action was successful or not. **Type:** `bool` **Required**: Yes  | 
| Error |  The error that occurred if the action was unsuccessful. **Type:** [GameLiftError](#integration-server-sdk5-cpp-datatypes-gamelifterror) **Required:** No  | 

## GetFleetRoleCredentialsResult
<a name="integration-server-sdk5-cpp-datatypes-getfleetrolecredentialsresult"></a>


| Properties | Description | 
| --- | --- | 
| AccessKeyId |  The access key ID to authenticate and provide access to your AWS resources. **Type:** `string` **Required:** No  | 
| AssumedRoleId |  The ID of the user that the service role belongs to. **Type:** `string` **Required:** No  | 
| AssumedRoleUserArn |  The Amazon Resource Name (ARN) of the user that the service role belongs to. **Type:** `string` **Required:** No  | 
| Expiration |  The amount of time until your session credentials expire. **Type:** `DateTime` **Required:** No  | 
| SecretAccessKey |  The secret access key ID for authentication. **Type:** `string` **Required:** No  | 
| SessionToken |  A token to identify the current active session interacting with your AWS resources. **Type:** `string` **Required:** No  | 
| Success |  Whether the action was successful or not. **Type:** `bool` **Required**: Yes  | 
| Error |  The error that occurred if the action was unsuccessful. **Type:** [GameLiftError](integration-server-sdk5-csharp-datatypes.md#integration-server-sdk5-csharp-datatypes-gamelifterror) **Required:** No  | 

## InitSDKOutcome
<a name="integration-server-sdk5-cpp-datatypes-initsdkoutcome"></a>

**Note**  
`InitSDKOutcome` is returned only when you build the SDK with the `std` flag. If you build with the `nostd` flag, then [GenericOutcome](#integration-server-sdk5-cpp-datatypes-genericoutcome) is returned instead.


| Properties | Description | 
| --- | --- | 
| Success |  Whether the action was successful or not. **Type:** `bool` **Required**: Yes  | 
| Error |  The error that occurred if the action was unsuccessful. **Type:** [GameLiftError](#integration-server-sdk5-cpp-datatypes-gamelifterror) **Required:** No  | 

## GameLiftError
<a name="integration-server-sdk5-cpp-datatypes-gamelifterror"></a>


| Properties | Description | 
| --- | --- | 
| ErrorType |  The type of error. **Type:** A `GameLiftErrorType` [enum](#integration-server-sdk5-cpp-dataypes-enums). **Required:** No   | 
| ErrorName |  The name of the error.  **Type:** `std::string`  **Required:** No   | 
| ErrorMessage |  The error message.  **Type:** `std::string`  **Required:** No   | 

## Enums
<a name="integration-server-sdk5-cpp-dataypes-enums"></a>

Enums defined for the server SDK for Amazon GameLift Servers (C\$1\$1) are defined as follows: 

**GameLiftErrorType**  
String value indicating the error type. Valid values include:  
+ **BAD\$1REQUEST\$1EXCEPTION** 
+ **GAMESESSION\$1ID\$1NOT\$1SET** – The game session ID has not been set. 
+ **INTERNAL\$1SERVICE\$1EXCEPTION** 
+ **LOCAL\$1CONNECTION\$1FAILED** – The local connection to Amazon GameLift Servers failed. 
+ **NETWORK\$1NOT\$1INITIALIZED** – The network has not been initialized. 
+ **SERVICE\$1CALL\$1FAILED** – A call to an AWS service has failed. 
+ **WEBSOCKET\$1CONNECT\$1FAILURE** 
+ **WEBSOCKET\$1CONNECT\$1FAILURE\$1FORBIDDEN** 
+ **WEBSOCKET\$1CONNECT\$1FAILURE\$1INVALID\$1URL** 
+ **WEBSOCKET\$1CONNECT\$1FAILURE\$1TIMEOUT** 
+ **ALREADY\$1INITIALIZED** – The Amazon GameLift Servers Server or Client has already been initialized with Initialize(). 
+ **FLEET\$1MISMATCH** – The target fleet does not match the fleet of a gameSession or playerSession. 
+ **GAMELIFT\$1CLIENT\$1NOT\$1INITIALIZED** – The Amazon GameLift Servers client has not been initialized. 
+ **GAMELIFT\$1SERVER\$1NOT\$1INITIALIZED** – The Amazon GameLift Servers server has not been initialized. 
+ **GAME\$1SESSION\$1ENDED\$1FAILED** – the server SDK for Amazon GameLift Servers could not contact the service to report the game session ended. 
+ **GAME\$1SESSION\$1NOT\$1READY** – The Amazon GameLift Servers Server Game Session was not activated. 
+ **GAME\$1SESSION\$1READY\$1FAILED** – the server SDK for Amazon GameLift Servers could not contact the service to report the game session is ready. 
+ **INITIALIZATION\$1MISMATCH** – A client method was called after Server::Initialize(), or vice versa. 
+ **NOT\$1INITIALIZED** – The Amazon GameLift Servers Server or Client has not been initialized with Initialize(). 
+ **NO\$1TARGET\$1ALIASID\$1SET** – A target aliasId has not been set. 
+ **NO\$1TARGET\$1FLEET\$1SET** – A target fleet has not been set. 
+ **PROCESS\$1ENDING\$1FAILED** – the server SDK for Amazon GameLift Servers could not contact the service to report the process is ending. 
+ **PROCESS\$1NOT\$1ACTIVE** – The server process is not yet active, not bound to a GameSession, and cannot accept or process PlayerSessions. 
+ **PROCESS\$1NOT\$1READY** – The server process is not yet ready to be activated. 
+ **PROCESS\$1READY\$1FAILED** – the server SDK for Amazon GameLift Servers could not contact the service to report the process is ready. 
+ **SDK\$1VERSION\$1DETECTION\$1FAILED** – SDK version detection failed. 
+ **STX\$1CALL\$1FAILED** – A call to the XStx server backend component has failed. 
+ **STX\$1INITIALIZATION\$1FAILED** – The XStx server backend component has failed to initialize. 
+ **UNEXPECTED\$1PLAYER\$1SESSION** – An unregistered player session was encountered by the server. 
+ **WEBSOCKET\$1CONNECT\$1FAILURE** 
+ **WEBSOCKET\$1CONNECT\$1FAILURE\$1FORBIDDEN** 
+ **WEBSOCKET\$1CONNECT\$1FAILURE\$1INVALID\$1URL** 
+ **WEBSOCKET\$1CONNECT\$1FAILURE\$1TIMEOUT** 
+ **WEBSOCKET\$1RETRIABLE\$1SEND\$1MESSAGE\$1FAILURE** – Retriable failure to send a message to the GameLift Service WebSocket. 
+ **WEBSOCKET\$1SEND\$1MESSAGE\$1FAILURE** – Failure to send a message to the GameLift Service WebSocket. 
+ **MATCH\$1BACKFILL\$1REQUEST\$1VALIDATION** – Validation of the request failed. 
+ **PLAYER\$1SESSION\$1REQUEST\$1VALIDATION** – Validation of the request failed. 

**PlayerSessionCreationPolicy**  
String value indicating whether the game session accepts new players. Valid values include:   
+ **ACCEPT\$1ALL** – Accept all new player sessions. 
+ **DENY\$1ALL** – Deny all new player sessions. 
+ **NOT\$1SET** – The game session is not set to accept or deny new player sessions. 

[C\$1\$1 server SDK 5.x for Amazon GameLift Servers -- Data types](integration-server-sdk5-cpp-datatypes.md)

**Topics**
+ [C\$1\$1 server SDK 5.x for Amazon GameLift Servers -- Data types](integration-server-sdk5-cpp-datatypes.md)
+ [GetSdkVersion()](#integration-server-sdk5-cpp-getsdkversion)
+ [InitMetrics()](#integration-server-sdk5-cpp-initmetrics)
+ [InitSDK()](#integration-server-sdk5-cpp-initsdk)
+ [InitSDK()](#integration-server-sdk5-cpp-initsdk-anywhere)
+ [ProcessReady()](#integration-server-sdk5-cpp-processready)
+ [ProcessReadyAsync()](#integration-server-sdk5-cpp-processreadyasync)
+ [ProcessEnding()](#integration-server-sdk5-cpp-processending)
+ [ActivateGameSession()](#integration-server-sdk5-cpp-activategamesession)
+ [UpdatePlayerSessionCreationPolicy()](#integration-server-sdk5-cpp-updateplayersessioncreationpolicy)
+ [GetGameSessionId()](#integration-server-sdk5-cpp-getgamesessionid)
+ [GetTerminationTime()](#integration-server-sdk5-cpp-getterm)
+ [AcceptPlayerSession()](#integration-server-sdk5-cpp-acceptplayersession)
+ [RemovePlayerSession()](#integration-server-sdk5-cpp-removeplayersession)
+ [DescribePlayerSessions()](#integration-server-sdk5-cpp-describeplayersessions)
+ [StartMatchBackfill()](#integration-server-sdk5-cpp-startmatchbackfill)
+ [StopMatchBackfill()](#integration-server-sdk5-cpp-stopmatchbackfill)
+ [GetComputeCertificate()](#integration-server-sdk5-cpp-getcomputecertificate)
+ [GetFleetRoleCredentials()](#integration-server-sdk5-cpp-getfleetrolecredentials)
+ [Destroy()](#integration-server-sdk5-cpp-ref-destroy)

## GetSdkVersion()
<a name="integration-server-sdk5-cpp-getsdkversion"></a>

Returns the current version number of the SDK built into the server process.

### Syntax
<a name="integration-server-sdk5-cpp-getsdkversion-syntax"></a>

```
Aws::GameLift::AwsStringOutcome Server::GetSdkVersion();
```

### Return value
<a name="integration-server-sdk5-cpp-getsdkversion-return"></a>

If successful, returns the current SDK version as an [AwsStringOutcome](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-datatypes-awsstringoutcome) object. The returned object includes the version number (example `5.0.0`). If not successful, returns an error message.

### Example
<a name="integration-server-sdk5-cpp-getsdkversion-example"></a>

```
Aws::GameLift::AwsStringOutcome SdkVersionOutcome = Aws::GameLift::Server::GetSdkVersion(); 
```

## InitMetrics()
<a name="integration-server-sdk5-cpp-initmetrics"></a>

Initializes the metrics system for collecting and reporting server performance data. For best results, call this method before [InitSDK()](#integration-server-sdk5-cpp-initsdk) to enable metrics collection during SDK initialization.

### Syntax
<a name="integration-server-sdk5-cpp-initmetrics-syntax"></a>

```
Aws::GameLift::GenericOutcome InitMetrics();
Aws::GameLift::GenericOutcome InitMetrics(const Aws::GameLift::Server::MetricsParameters &metricsParameters);
```

### Parameters
<a name="integration-server-sdk5-cpp-initmetrics-parameter"></a>

[MetricsParameters](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-datatypes-metricsparameters) (optional)  
Configuration parameters for metrics collection. If not provided, uses default values that can be overridden by environment variables.

### Return value
<a name="integration-server-sdk5-cpp-initmetrics-return"></a>

If successful, returns a [GenericOutcome](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-datatypes-genericoutcome) object indicating success. If not successful, returns an error message.

### Example
<a name="integration-server-sdk5-cpp-initmetrics-example"></a>

```
// Initialize with default parameters (uses environment variables if available)
// Defaults: localhost:8125 for StatsD, localhost:8126 for crash reporter
// FlushInterval: 10000ms, MaxPacketSize: 512 bytes
Aws::GameLift::GenericOutcome outcome = Aws::GameLift::Server::InitMetrics();
if (outcome.IsSuccess()) {
    // Metrics system initialized successfully
}

// Initialize with custom parameters
Aws::GameLift::Server::MetricsParameters metricsParams("localhost", 8125, "crash-host", 8126, 5000, 1024);
Aws::GameLift::GenericOutcome customOutcome = Aws::GameLift::Server::InitMetrics(metricsParams);
if (customOutcome.IsSuccess()) {
    // Metrics system initialized with custom parameters
}
```

## InitSDK()
<a name="integration-server-sdk5-cpp-initsdk"></a>

Initializes the Amazon GameLift Servers SDK. Call this method on launch before any other initialization steps related to Amazon GameLift Servers. This action reads server parameters from the host environment to set up communication between the game server process and the Amazon GameLift Servers service. It uses an idempotency token, so you safely retry this call when it fails.

If the game server build will be deployed without the Amazon GameLift Servers Agent to a Amazon GameLift Servers Anywhere fleet or container fleet, call [InitSDK()](#integration-server-sdk5-cpp-initsdk-anywhere) and specify a set of server parameters.

### Syntax
<a name="integration-server-sdk5-cpp-initsdk-syntax"></a>

```
Server::InitSDKOutcome Server::initSdkOutcome = InitSDK();
```

### Return value
<a name="integration-server-sdk5-cpp-initsdk-return"></a>

Returns an [InitSDKOutcome](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-datatypes-initsdkoutcome) object that indicates whether the server process is ready to call [ProcessReady()](#integration-server-sdk5-cpp-processready). 

### Example
<a name="integration-server-sdk5-cpp-initsdk-example"></a>

```
//Call InitSDK to establish a local connection with the Amazon GameLift Servers Agent to enable further communication.
Aws::GameLift::Server::InitSDKOutcome initSdkOutcome = 
  Aws::GameLift::Server::InitSDK();
```

## InitSDK()
<a name="integration-server-sdk5-cpp-initsdk-anywhere"></a>

Initializes the Amazon GameLift Servers SDK. Call this method on launch before any other initialization steps related to Amazon GameLift Servers. This action requires a set of server parameters to set up communication between the game server process and the Amazon GameLift Servers service. It uses an idempotency token, so you safely retry this call when it fails.

If the game server build will be deployed to an Amazon GameLift Servers managed EC2 fleet or to an Amazon GameLift Servers Anywhere fleet or container fleet with the Amazon GameLift Servers Agent, call [InitSDK()](#integration-server-sdk5-cpp-initsdk) without server parameters.

### Syntax
<a name="integration-server-sdk5-cpp-initsdk-anywhere-syntax"></a>

```
Server::InitSDKOutcome Server::initSdkOutcome = InitSDK(serverParameters);
```

### Parameters
<a name="integration-server-sdk5-cpp-initsdk-anywhere-parameter"></a>

[ServerParameters](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-dataypes-serverparameters)  
To initialize a game server on an Amazon GameLift Servers Anywhere fleet, construct a `ServerParameters` object with the following information:  
+ The URL of the WebSocket used to connect to your game server. 
+ The ID of the process used to host your game server. 
+ The ID of the compute hosting your game server processes. 
+ The ID of the Amazon GameLift Servers fleet containing your Amazon GameLift Servers Anywhere compute.
+ The authorization token generated by the Amazon GameLift Servers operation. 

### Return value
<a name="integration-server-sdk5-cpp-initsdk-anywhere-return"></a>

Returns an [InitSDKOutcome](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-datatypes-initsdkoutcome) object that indicates whether the server process is ready to call [ProcessReady()](#integration-server-sdk5-cpp-processready). 

**Note**  
If calls to `InitSDK()` are failing for game builds deployed to Anywhere fleets, check the `ServerSdkVersion` parameter used when creating the build resource. You must explicitly set this value to the server SDK version in use. The default value for this parameter is 4.x, which is not compatible. To resolve this issue, create a new build and deploy it to a new fleet.

### Example
<a name="integration-server-sdk5-cpp-initsdk-anywhere-example"></a>

Amazon GameLift Servers Anywhere example

```
//Define the server parameters
std::string websocketUrl = "wss://us-west-1.api.amazongamelift.com";
std::string processId = "PID1234";
std::string fleetId = "arn:aws:gamelift:us-west-1:111122223333:fleet/fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa";
std::string hostId = "HardwareAnywhere";
std::string authToken = "1111aaaa-22bb-33cc-44dd-5555eeee66ff";
Aws::GameLift::Server::Model::ServerParameters serverParameters = 
  Aws::GameLift::Server::Model::ServerParameters(webSocketUrl, authToken, fleetId, hostId, processId);

//Call InitSDK to establish a local connection with the Amazon GameLift Servers Agent to enable further communication.
Aws::GameLift::Server::InitSDKOutcome initSdkOutcome = Aws::GameLift::Server::InitSDK(serverParameters);
```

## ProcessReady()
<a name="integration-server-sdk5-cpp-processready"></a>

Notifies Amazon GameLift Servers that the server process is ready to host game sessions. Call this method after invoking [InitSDK()](#integration-server-sdk5-cpp-initsdk). This method should be called only once per process.

### Syntax
<a name="integration-server-sdk5-cpp-processready-syntax"></a>

`GenericOutcome ProcessReady(const Aws::GameLift::Server::ProcessParameters &processParameters);`

### Parameters
<a name="integration-server-sdk5-cpp-processready-parameter"></a>

**processParameters**  
A [ProcessParameters](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-dataypes-process) object communicating the following information about the server process:  
+ Names of callback methods implemented in the game server code that the Amazon GameLift Servers service invokes to communicate with the server process.
+ Port number that the server process is listening on.
+ Path to any game session-specific files that you want Amazon GameLift Servers to capture and store.

### Return value
<a name="integration-server-sdk5-cpp-processready-return"></a>

Returns a generic outcome consisting of success or failure with an error message.

### Example
<a name="integration-server-sdk5-cpp-processready-example"></a>

This example illustrates both the [ProcessReady()](#integration-server-sdk5-cpp-processready) call and delegate function implementations.

```
// Set parameters and call ProcessReady
std::string serverLog("serverOut.log");        // Example of a log file written by the game server
std::vector<std::string> logPaths;
logPaths.push_back(serverLog);
int listenPort = 9339;

Aws::GameLift::Server::ProcessParameters processReadyParameter = 
  Aws::GameLift::Server::ProcessParameters(
    std::bind(&Server::onStartGameSession, this, std::placeholders::_1),
    std::bind(&Server::onProcessTerminate, this), 
    std::bind(&Server::OnHealthCheck, this), 
    std::bind(&Server::OnUpdateGameSession, this), 
    listenPort, 
    Aws::GameLift::Server::LogParameters(logPaths)
  ); 

Aws::GameLift::GenericOutcome outcome = 
  Aws::GameLift::Server::ProcessReady(processReadyParameter);

// Implement callback functions
void Server::onStartGameSession(Aws::GameLift::Model::GameSession myGameSession)
{
  // game-specific tasks when starting a new game session, such as loading map
  GenericOutcome outcome = 
    Aws::GameLift::Server::ActivateGameSession (maxPlayers);
}

void Server::onProcessTerminate()
{
  // game-specific tasks required to gracefully shut down a game session, 
  // such as notifying players, preserving game state data, and other cleanup
  GenericOutcome outcome = Aws::GameLift::Server::ProcessEnding();
}

bool Server::onHealthCheck()
{
  bool health;
  // complete health evaluation within 60 seconds and set health
  return health;
}
```

## ProcessReadyAsync()
<a name="integration-server-sdk5-cpp-processreadyasync"></a>

Notifies the Amazon GameLift Servers service that the server process is ready to host game sessions. This method should be called after the server process is ready to host a game session. The parameters specify the callback function names for Amazon GameLift Servers to call in certain circumstances. Game server code must implement these functions.

This call is asynchronous. To make a synchronous call, use [ProcessReady()](#integration-server-sdk5-cpp-processready). See [Initialize the server process](gamelift-sdk-server-api.md#gamelift-sdk-server-initialize) for more details.

### Syntax
<a name="integration-server-sdk5-cpp-processreadyasync-syntax"></a>

```
GenericOutcomeCallable ProcessReadyAsync(
    const Aws::GameLift::Server::ProcessParameters &processParameters);
```

### Parameters
<a name="integration-server-sdk5-cpp-processreadyasync-parameter"></a>

**processParameters**  
A [ProcessParameters](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-dataypes-process) object communicating the following information about the server process:  
+ Names of callback methods implemented in the game server code that the Amazon GameLift Servers service invokes to communicate with the server process.
+ Port number that the server process is listening on.
+ Path to any game session-specific files that you want Amazon GameLift Servers to capture and store.
Required: Yes

### Return value
<a name="integration-server-sdk5-cpp-processreadyasync-return"></a>

Returns a generic outcome consisting of success or failure with an error message.

### Example
<a name="integration-server-sdk5-cpp-processreadyasync-example"></a>

```
// Set parameters and call ProcessReady
std::string serverLog("serverOut.log");        // This is an example of a log file written by the game server
std::vector<std::string> logPaths;
logPaths.push_back(serverLog);
int listenPort = 9339;

Aws::GameLift::Server::ProcessParameters processReadyParameter = 
  Aws::GameLift::Server::ProcessParameters(std::bind(&Server::onStartGameSession, this, std::placeholders::_1),
  std::bind(&Server::onProcessTerminate, this), std::bind(&Server::OnHealthCheck, this),
  std::bind(&Server::OnUpdateGameSession, this), listenPort, Aws::GameLift::Server::LogParameters(logPaths));

Aws::GameLift::GenericOutcomeCallable outcome = 
  Aws::GameLift::Server::ProcessReadyAsync(processReadyParameter);

// Implement callback functions
void onStartGameSession(Aws::GameLift::Model::GameSession myGameSession)
{
  // game-specific tasks when starting a new game session, such as loading map
  GenericOutcome outcome = Aws::GameLift::Server::ActivateGameSession (maxPlayers);
}

void onProcessTerminate()
{
  // game-specific tasks required to gracefully shut down a game session, 
  // such as notifying players, preserving game state data, and other cleanup
  GenericOutcome outcome = Aws::GameLift::Server::ProcessEnding();
}

bool onHealthCheck()
{
  // perform health evaluation and complete within 60 seconds
  return health;
}
```

## ProcessEnding()
<a name="integration-server-sdk5-cpp-processending"></a>

Notifies Amazon GameLift Servers that the server process is terminating. Call this method after all other cleanup tasks (including shutting down the active game session) and before terminating the process. Depending on the result of `ProcessEnding()`, the process exits with success (0) or error (-1) and generates a fleet event. If the process terminates with an error, the fleet event generated is `SERVER_PROCESS_TERMINATED_UNHEALTHY`.

### Syntax
<a name="integration-server-sdk5-cpp-processending-syntax"></a>

```
Aws::GameLift::GenericOutcome processEndingOutcome = Aws::GameLift::Server::ProcessEnding();
```

### Return value
<a name="integration-server-sdk5-cpp-processending-return"></a>

Returns a generic outcome consisting of success or failure with an error message.

### Example
<a name="integration-server-sdk5-cpp-processending-example"></a>

This example calls `ProcessEnding()` and `Destroy()` before terminating the server process with a success or error exit code.

```
Aws::GameLift::GenericOutcome processEndingOutcome = Aws::GameLift::Server::ProcessEnding();
Aws::GameLift::Server::Destroy();

// Exit the process with success or failure
if (processEndingOutcome.IsSuccess()) {
  exit(0);
}
else {
  cout << "ProcessEnding() failed. Error: " << processEndingOutcome.GetError().GetErrorMessage();
  exit(-1);
}
```

## ActivateGameSession()
<a name="integration-server-sdk5-cpp-activategamesession"></a>

Notifies Amazon GameLift Servers that the server process has activated a game session and is now ready to receive player connections. This action should be called as part of the `onStartGameSession()` callback function, after all game session initialization.

### Syntax
<a name="integration-server-sdk5-cpp-activategamesession-syntax"></a>

```
Aws::GameLift::GenericOutcome activateGameSessionOutcome = Aws::GameLift::Server::ActivateGameSession();
```

### Return value
<a name="integration-server-sdk5-cpp-activategamesession-return"></a>

Returns a generic outcome consisting of success or failure with an error message.

### Example
<a name="integration-server-sdk5-cpp-activategamesession-example"></a>

This example shows `ActivateGameSession()` called as part of the `onStartGameSession()` delegate function. 

```
void onStartGameSession(Aws::GameLift::Model::GameSession myGameSession)
{
  // game-specific tasks when starting a new game session, such as loading map
  GenericOutcome outcome = Aws::GameLift::Server::ActivateGameSession();
}
```

## UpdatePlayerSessionCreationPolicy()
<a name="integration-server-sdk5-cpp-updateplayersessioncreationpolicy"></a>

Updates the current game session's ability to accept new player sessions. A game session can be set to either accept or deny all new player sessions.

### Syntax
<a name="integration-server-sdk5-cpp-updateplayersessioncreationpolicy-syntax"></a>

```
GenericOutcome UpdatePlayerSessionCreationPolicy(Aws::GameLift::Model::PlayerSessionCreationPolicy newPlayerSessionPolicy);
```

### Parameters
<a name="integration-server-sdk5-cpp-updateplayersessioncreationpolicy-parameter"></a>

**playerCreationSessionPolicy**  
Type: `PlayerSessionCreationPolicy` [enum](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-dataypes-enums) value.  
Required: Yes

### Return value
<a name="integration-server-sdk5-cpp-updateplayersessioncreationpolicy-return"></a>

Returns a generic outcome consisting of success or failure with an error message.

### Example
<a name="integration-server-sdk5-cpp-updateplayersessioncreationpolicy-example"></a>

This example sets the current game session's join policy to accept all players.

```
Aws::GameLift::GenericOutcome outcome = 
  Aws::GameLift::Server::UpdatePlayerSessionCreationPolicy(Aws::GameLift::Model::PlayerSessionCreationPolicy::ACCEPT_ALL);
```

## GetGameSessionId()
<a name="integration-server-sdk5-cpp-getgamesessionid"></a>

Retrieves the ID of the game session hosted by the active server process. 

For idle processes that aren't activated with a game session, the call returns a [GameLiftError](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-datatypes-gamelifterror).

### Syntax
<a name="integration-server-sdk5-cpp-getgamesessionid-syntax"></a>

```
AwsStringOutcome GetGameSessionId()
```

### Parameters
<a name="integration-server-sdk5-cpp-getgamesessionid-parameter"></a>

This action has no parameters.

### Return value
<a name="integration-server-sdk5-cpp-getgamesessionid-return"></a>

If successful, returns the game session ID as an [AwsStringOutcome](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-datatypes-awsstringoutcome) object. If not successful, returns an error message.

For idle processes that aren't activated with a game session, the call returns `Success`=`True` and `GameSessionId`=`""`.

### Example
<a name="integration-server-sdk5-cpp-getgamesessionid-example"></a>

```
Aws::GameLift::AwsStringOutcome sessionIdOutcome = Aws::GameLift::Server::GetGameSessionId();
```

## GetTerminationTime()
<a name="integration-server-sdk5-cpp-getterm"></a>

Returns the time that a server process is scheduled to be shut down, if a termination time is available. A server process takes action after receiving an `onProcessTerminate()` callback from Amazon GameLift Servers. Amazon GameLift Servers calls `onProcessTerminate()` for the following reasons: 
+ When the server process has reported poor health or has not responded to Amazon GameLift Servers.
+ When terminating the instance during a scale-down event.
+ When an instance is terminated due to a [spot-instance interruption](spot-tasks.md).

### Syntax
<a name="integration-server-sdk5-cpp-getterm-syntax"></a>

```
AwsDateTimeOutcome GetTerminationTime()
```

### Return value
<a name="integration-server-sdk5-cpp-getterm-return"></a>

If successful, returns the termination time as an `AwsDateTimeOutcome` object. The value is the termination time, expressed in elapsed ticks since `0001 00:00:00`. For example, the date time value `2020-09-13 12:26:40 -000Z` is equal to `637355968000000000` ticks. If no termination time is available, returns an error message.

If the process hasn't received a ProcessParameters.OnProcessTerminate() callback, an error message is returned. For more information about shutting down a server process, see [Respond to a server process shutdown notification](gamelift-sdk-server-api.md#gamelift-sdk-server-terminate).

### Example
<a name="integration-server-sdk5-cpp-getterm-example"></a>

```
Aws::GameLift::AwsLongOutcome TermTimeOutcome = Aws::GameLift::Server::GetTerminationTime(); 
```

## AcceptPlayerSession()
<a name="integration-server-sdk5-cpp-acceptplayersession"></a>

Notifies Amazon GameLift Servers that a player with the specified player session ID has connected to the server process and needs validation. Amazon GameLift Servers verifies that the player session ID is valid. After the player session is validated, Amazon GameLift Servers changes the status of the player slot from RESERVED to ACTIVE. 

### Syntax
<a name="integration-server-sdk5-cpp-acceptplayersession-syntax"></a>

```
GenericOutcome AcceptPlayerSession(String playerSessionId)
```

### Parameters
<a name="integration-server-sdk5-cpp-acceptplayersession-parameter"></a>

playerSessionId  
Unique ID issued by Amazon GameLift Servers when a new player session is created.

### Return value
<a name="integration-server-sdk5-cpp-acceptplayersession-return"></a>

Returns a generic outcome consisting of success or failure with an error message. 

### Example
<a name="integration-server-sdk5-cpp-acceptplayersession-example"></a>

This example handles a connection request that includes validating and rejecting non-valid player session IDs.

```
void ReceiveConnectingPlayerSessionID (Connection& connection, const std::string& playerSessionId)
{
  Aws::GameLift::GenericOutcome connectOutcome = Aws::GameLift::Server::AcceptPlayerSession(playerSessionId);
  if(connectOutcome.IsSuccess())
  {
    connectionToSessionMap.emplace(connection, playerSessionId);
    connection.Accept();
  }
  else 
  {
    connection.Reject(connectOutcome.GetError().GetMessage();
  }       
}
```

## RemovePlayerSession()
<a name="integration-server-sdk5-cpp-removeplayersession"></a>

Notifies Amazon GameLift Servers that a player has disconnected from the server process. In response, Amazon GameLift Servers changes the player slot to available. 

### Syntax
<a name="integration-server-sdk5-cpp-removeplayersession-syntax"></a>

```
GenericOutcome RemovePlayerSession(String playerSessionId)
```

### Parameters
<a name="integration-server-sdk5-cpp-removeplayersession-parameter"></a>

**`playerSessionId`**  
Unique ID issued by Amazon GameLift Servers when a new player session is created.

### Return value
<a name="integration-server-sdk5-cpp-removeplayersession-return"></a>

Returns a generic outcome consisting of success or failure with an error message.

### Example
<a name="integration-server-sdk5-cpp-removeplayersession-example"></a>

```
Aws::GameLift::GenericOutcome disconnectOutcome = Aws::GameLift::Server::RemovePlayerSession(playerSessionId);
```

## DescribePlayerSessions()
<a name="integration-server-sdk5-cpp-describeplayersessions"></a>

Retrieves player session data which includes settings, session metadata, and player data. Use this method to get information about the following:
+ A single player session
+ All player sessions in a game session
+ All player sessions associated with a single player ID

### Syntax
<a name="integration-server-sdk5-cpp-describeplayersessions-syntax"></a>

```
DescribePlayerSessionsOutcome DescribePlayerSessions(DescribePlayerSessionsRequest describePlayerSessionsRequest)
```

### Parameters
<a name="integration-server-sdk5-cpp-describeplayersessions-parameter"></a>

**[DescribePlayerSessionsRequest](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-dataypes-playersessions)**  
A [DescribePlayerSessionsRequest](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-dataypes-playersessions) object that describes which player sessions to retrieve.

### Return value
<a name="integration-server-sdk5-cpp-describeplayersessions-return"></a>

If successful, returns a [DescribePlayerSessionsOutcome](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-datatypes-describeplayersessionsoutcome) object containing a set of player session objects that fit the request parameters.

### Example
<a name="integration-server-sdk5-cpp-describeplayersessions-example"></a>

This example requests all player sessions actively connected to a specified game session. By omitting *NextToken* and setting the *Limit* value to 10, Amazon GameLift Servers returns the first 10 player session records matching the request.

```
// Set request parameters
Aws::GameLift::Server::Model::DescribePlayerSessionsRequest request;
request.SetPlayerSessionStatusFilter(Aws::GameLift::Server::Model::PlayerSessionStatusMapper::GetNameForPlayerSessionStatus(Aws::GameLift::Server::Model::PlayerSessionStatus::Active));
request.SetLimit(10);
request.SetGameSessionId("the game session ID");    // can use GetGameSessionId()

// Call DescribePlayerSessions
Aws::GameLift::DescribePlayerSessionsOutcome playerSessionsOutcome = Aws::GameLift::Server::DescribePlayerSessions(request);
```

## StartMatchBackfill()
<a name="integration-server-sdk5-cpp-startmatchbackfill"></a>

Sends a request to find new players for open slots in a game session created with FlexMatch. For more information, see [FlexMatch backfill feature](https://docs.aws.amazon.com/gameliftservers/latest/flexmatchguide/match-backfill.html).

This action is asynchronous. If new players are matched, Amazon GameLift Servers delivers updated matchmaker data using the callback function `OnUpdateGameSession()`.

A server process can have only one active match backfill request at a time. To send a new request, first call [StopMatchBackfill()](#integration-server-sdk5-cpp-stopmatchbackfill) to cancel the original request.

### Syntax
<a name="integration-server-sdk5-cpp-startmatchbackfill-syntax"></a>

```
StartMatchBackfillOutcome StartMatchBackfill (StartMatchBackfillRequest startBackfillRequest);
```

### Parameters
<a name="integration-server-sdk5-cpp-startmatchbackfill-parameter"></a>

**[StartMatchBackfillRequest](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-dataypes-startmatchbackfillrequest)**  
A StartMatchBackfillRequest object that communicates the following information:  
+ A ticket ID to assign to the backfill request. This information is optional; if no ID is provided, Amazon GameLift Servers will generate one.
+ The matchmaker to send the request to. The full configuration ARN is required. This value is in the game session's matchmaker data.
+ The ID of the game session to backfill.
+ The available matchmaking data for the game session's current players.

### Return value
<a name="integration-server-sdk5-cpp-startmatchbackfill-return"></a>

Returns a [StartMatchBackfillOutcome](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-datatypes-startmatchbackfilloutcome) object with the match backfill ticket ID, or failure with an error message. 

### Example
<a name="integration-server-sdk5-cpp-startmatchbackfill-example"></a>

```
// Build a backfill request
std::vector<Player> players;
Aws::GameLift::Server::Model::StartMatchBackfillRequest startBackfillRequest;
startBackfillRequest.SetTicketId("1111aaaa-22bb-33cc-44dd-5555eeee66ff");  // optional, autogenerated if not provided
startBackfillRequest.SetMatchmakingConfigurationArn("arn:aws:gamelift:us-west-2:111122223333:matchmakingconfiguration/MyMatchmakerConfig"); //from the game session matchmaker data
startBackfillRequest.SetGameSessionArn("the game session ARN");        // can use GetGameSessionId()
startBackfillRequest.SetPlayers(players);                                  // from the game session matchmaker data

// Send backfill request
Aws::GameLift::StartMatchBackfillOutcome backfillOutcome = 
  Aws::GameLift::Server::StartMatchBackfill(startBackfillRequest);

// Implement callback function for backfill
void Server::OnUpdateGameSession(Aws::GameLift::Server::Model::GameSession gameSession, Aws::GameLift::Server::Model::UpdateReason updateReason, std::string backfillTicketId)
{
  // handle status messages
  // perform game-specific tasks to prep for newly matched players
}
```

## StopMatchBackfill()
<a name="integration-server-sdk5-cpp-stopmatchbackfill"></a>

Cancels an active match backfill request. For more information, see [FlexMatch backfill feature](https://docs.aws.amazon.com/gameliftservers/latest/flexmatchguide/match-backfill.html).

### Syntax
<a name="integration-server-sdk5-cpp-stopmatchbackfill-syntax"></a>

```
GenericOutcome StopMatchBackfill (StopMatchBackfillRequest stopBackfillRequest);
```

### Parameters
<a name="integration-server-sdk5-cpp-stopmatchbackfill-parameter"></a>

**[StopMatchBackfillRequest](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-dataypes-stopmatchbackfillrequest)**  
A StopMatchBackfillRequest object identifying the matchmaking ticket to cancel:   
+ The ticket ID assigned to the backfill request.
+ The matchmaker the backfill request was sent to.
+ The game session associated with the backfill request.

### Return value
<a name="integration-server-sdk5-cpp-stopmatchbackfill-return"></a>

Returns a generic outcome consisting of success or failure with an error message.

### Example
<a name="integration-server-sdk5-cpp-stopmatchbackfill-example"></a>

```
// Set backfill stop request parameters

Aws::GameLift::Server::Model::StopMatchBackfillRequest stopBackfillRequest;
stopBackfillRequest.SetTicketId("1111aaaa-22bb-33cc-44dd-5555eeee66ff");
stopBackfillRequest.SetGameSessionArn("the game session ARN"); // can use GetGameSessionId()
stopBackfillRequest.SetMatchmakingConfigurationArn("arn:aws:gamelift:us-west-2:111122223333:matchmakingconfiguration/MyMatchmakerConfig");
// from the game session matchmaker data

Aws::GameLift::GenericOutcome stopBackfillOutcome = 
  Aws::GameLift::Server::StopMatchBackfill(stopBackfillRequest);
```

## GetComputeCertificate()
<a name="integration-server-sdk5-cpp-getcomputecertificate"></a>

Retrieves the path to the TLS certificate used to encrypt the network connection between your Amazon GameLift Servers Anywhere compute resource and Amazon GameLift Servers. You can use the certificate path when you register your compute device to a Amazon GameLift Servers Anywhere fleet. For more information see, [RegisterCompute](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_RegisterCompute.html).

### Syntax
<a name="integration-server-sdk5-cpp-getcomputecertificate-syntax"></a>

```
GetComputeCertificateOutcome Server::GetComputeCertificate()
```

### Return value
<a name="integration-server-sdk5-cpp-getcomputecertificate-return"></a>

Returns a [GetComputeCertificateOutcome](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-datatypes-getcomputecertificateoutcome).

### Example
<a name="integration-server-sdk5-cpp-getcomputecertificate-example"></a>

```
Aws::GameLift::GetComputeCertificateOutcome certificate = Aws::GameLift::Server::GetComputeCertificate();
```

## GetFleetRoleCredentials()
<a name="integration-server-sdk5-cpp-getfleetrolecredentials"></a>

Retrieves IAM role credentials that authorize Amazon GameLift Servers to interact with other AWS services. For more information, see [Connect your Amazon GameLift Servers hosted game server to other AWS resources](gamelift-sdk-server-resources.md).

### Syntax
<a name="integration-server-sdk5-cpp-getfleetrolecredentials-syntax"></a>

```
GetFleetRoleCredentialsOutcome GetFleetRoleCredentials(GetFleetRoleCredentialsRequest request);
```

### Parameters
<a name="integration-server-sdk5-cpp-getfleetrolecredentials-parameters"></a>

[GetFleetRoleCredentialsRequest](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-dataypes-getfleetrolecredentialsrequest)

### Return value
<a name="integration-server-sdk5-cpp-getfleetrolecredentials-return"></a>

Returns a [GetFleetRoleCredentialsOutcome](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-datatypes-getfleetrolecredentialsoutcome) object.

### Example
<a name="integration-server-sdk5-cpp-getfleetrolecredentials-example"></a>

```
// form the fleet credentials request 
Aws::GameLift::Server::Model::GetFleetRoleCredentialsRequest getFleetRoleCredentialsRequest; 
getFleetRoleCredentialsRequest.SetRoleArn("arn:aws:iam::123456789012:role/service-role/exampleGameLiftAction");

Aws::GameLift::GetFleetRoleCredentialsOutcome credentials = Aws::GameLift::Server::GetFleetRoleCredentials(getFleetRoleCredentialsRequest);
```

This example shows the use of the optional `RoleSessionName` value to assign a name to the credentials session for auditing purposes. If you don't provide a role session name, the default value "*[fleet-id]*-*[host-id]*" is used.

```
// form the fleet credentials request 
Aws::GameLift::Server::Model::GetFleetRoleCredentialsRequest getFleetRoleCredentialsRequest; 
getFleetRoleCredentialsRequest.SetRoleArn("arn:aws:iam::123456789012:role/service-role/exampleGameLiftAction");
getFleetRoleCredentialsRequest.SetRoleSessionName("MyFleetRoleSession"); 

Aws::GameLift::GetFleetRoleCredentialsOutcome credentials = Aws::GameLift::Server::GetFleetRoleCredentials(getFleetRoleCredentialsRequest);
```

## Destroy()
<a name="integration-server-sdk5-cpp-ref-destroy"></a>

Frees the Amazon GameLift Servers game server SDK from memory. As a best practice, call this method after `ProcessEnding()` and before terminating the process. If you're using an Anywhere fleet and you're not terminating server processes after every game session, call `Destroy()` and then `InitSDK()` to reinitialize before notifying Amazon GameLift Servers that the process is ready to host a game session with `ProcessReady()`.

### Syntax
<a name="integration-server-sdk5-cpp-ref-destroy-syntax"></a>

```
GenericOutcome Aws::GameLift::Server::Destroy();
```

### Parameters
<a name="integration-server-sdk5-cpp-ref-destroy-parameter"></a>

There are no parameters.

### Return value
<a name="integration-server-sdk5-cpp-ref-destroy-return"></a>

Returns a generic outcome consisting of success or failure with an error message.

### Example
<a name="integration-server-sdk5-cpp-ref-destroy-example"></a>

```
Aws::GameLift::GenericOutcome processEndingOutcome = Aws::GameLift::Server::ProcessEnding();
Aws::GameLift::Server::Destroy();

// Exit the process with success or failure
if (processEndingOutcome.IsSuccess()) {
  exit(0);
}
else {
  cout << "ProcessEnding() failed. Error: " << processEndingOutcome.GetError().GetErrorMessage();
  exit(-1);
}
```