

# Server SDK 5.x for Amazon GameLift Servers
<a name="reference-serversdk"></a>

This section provides reference documentation for the server SDK 5.x for Amazon GameLift Servers. The server SDK provides core functionality that your game server uses to interact with the Amazon GameLift Servers service. For example, your game server receives prompts from the service to start and stop game sessions and it provides regular game session status updates to the service. Integrate your game servers with the server SDK before you deploy them for hosting.

Use this server SDK reference to integrate your custom multiplayer game servers 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).

The latest major version of the server SDK for Amazon GameLift Servers is 5.x. The following hosting features require the use of version 5.x: 
+ Amazon GameLift Servers Anywhere
+ Amazon GameLift Servers plugin for Unreal Engine and Unity

**Note**  
If you need to use server SDK version 4.x or earlier, see [Server SDK for Amazon GameLift Servers version 4 and earlier](reference-serversdk4.md) for documentation and download information.

**Topics**
+ [Updates in server SDK 5 for Amazon GameLift Servers](#reference-serversdk5-about)
+ [Migrate to server SDK 5.x for Amazon GameLift Servers](reference-serversdk5-migration.md)
+ [C\$1\$1 server SDK 5.x for Amazon GameLift Servers -- Actions](integration-server-sdk5-cpp-actions.md)
+ [C\$1 server SDK 5.x for Amazon GameLift Servers -- Actions](integration-server-sdk5-csharp-actions.md)
+ [Go server SDK for Amazon GameLift Servers -- Actions](integration-server-sdk-go-actions.md)
+ [C\$1\$1 (Unreal) server SDK 5.x for Amazon GameLift Servers -- Actions](integration-server-sdk5-unreal-actions.md)

## Updates in server SDK 5 for Amazon GameLift Servers
<a name="reference-serversdk5-about"></a>

Your hosted game servers use the server SDK for Amazon GameLift Servers to communicate with the Amazon GameLift Servers service to start and manage game sessions for players. The latest version, Amazon GameLift Servers server SDK 5, offers a number of improvements and support for new Amazon GameLift Servers features. If your game server build currently uses Amazon GameLift Servers server SDK 4 or earlier, follow the guidance in this topic to update your games. 

Amazon GameLift Servers server SDK version 5.0.0 and above includes these updates:
+ Expanded languages – Libraries are available in the following languages: C\$1\$1, C\$1, Go. You can build the C\$1\$1 libraries for use with Unreal Engine.
+ Game engine plugin support – The Amazon GameLift Servers standalone plugins for Unreal Engine and Unity require Amazon GameLift Servers server SDK 5 libraries. These plugins offer guided workflows for integrating, testing, and deploying your games to Amazon GameLift Servers for hosting. See [Amazon GameLift Servers plugin for Unity (server SDK 5.x)](unity-plug-in.md) and [Amazon GameLift Servers plugin for Unreal Engine](unreal-plugin.md) documentation.
+ Amazon GameLift Servers Anywhere support – With Anywhere fleets you can set up your own hosting resources to use Amazon GameLift Servers features (including matchmaking). Add the Amazon GameLift Servers Agent to automate game session life cycle management. Use Anywhere fleets for production hosting with on- premises hardware, or set up test environments for fast iterative game development. See [Anywhere hosting](gamelift-intro-flavors.md#gamelift-intro-flavors-hosting-anywhere) and the [Amazon GameLift Servers Agent](https://github.com/aws/amazon-gamelift-agent).
+ Updated testing tools – The Amazon GameLift Servers Anywhere feature lets you set up local or cloud-based test environments for your games. Set up testing with or without the Amazon GameLift Servers Agent. These tools replace Amazon GameLift Servers Local. See [Set up local testing with Amazon GameLift Servers Anywhere](integration-testing.md).
+ Consolidated .NET solution for C\$1 – The C\$1 server SDK 5.1\$1 supports .NET Framework 4.6.2 (upgraded from 4.6.1) and .NET 6.0 in a single solution. .NET Standard 2.1 is available with the Unity-built libraries.
+ New `Compute` resource – This new resource combines different types of hosting resources. It includes cloud-based hosting resources (managed EC2 or container fleets) and customer-controlled hosting resources (Anywhere fleets). It includes the following updates: 
  + New API calls for the `Compute` resource include: [ListCompute()](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_ListCompute.html), [DescribeCompute()](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_DescribeCompute.html), and [GetComputeAccess()](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_GetComputeAccess.html). These actions return hosting resource information for any type of Amazon GameLift Servers fleet. In general, for fleets with game servers that use server SDK 5.x, use the compute-specific actions to replace instance-specific actions. In addition, these actions are for use in Anywhere fleets without the Amazon GameLift Servers Agent: [RegisterCompute()](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_RegisterCompute.html), [DeregisterCompute()](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_DeregisterCompute.html), and [GetComputeAuthToken()](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_GetComputeAuthToken.html).
  + New metric `ActiveCompute` with CloudWatch dimensions `FleetId`, `Location`, and `ComputeType`. This metric replaces the previous metric `ActiveInstances`.
+ Amazon EC2 Systems Manager (SSM )for remote access – For added security, use SSM instead of SSH when connecting to instances in Amazon GameLift Servers managed fleets. See [Connect to fleet instances](fleets-remote-access.md).

# Migrate to server SDK 5.x for Amazon GameLift Servers
<a name="reference-serversdk5-migration"></a>

To update a game project to use server SDK version 5.x, make the following changes:

**Note**  
If you need to continue using server SDK version 4.x or earlier, see [Server SDK for Amazon GameLift Servers version 4 and earlier](reference-serversdk4.md) for documentation and download information. For SDK version 4.0.2 specifically, you can download it from the [official GitHub releases](https://github.com/amazon-gamelift/amazon-gamelift-servers-csharp-server-sdk/releases).

1. Get the latest server SDK for Amazon GameLift Servers package for your development environment **[[Download site](https://aws.amazon.com/gamelift/servers/getting-started-sdks/)]**. Follow the installation instructions in the `Readme` file for your downloaded package and version. See these instructions for using the server SDKs with your game project.
   + [For development environments using C\$1\$1, C\$1, or Go](gamelift-sdk-server-api.md)
   + [For Unreal Engine projects (C\$1\$1 server SDK for Unreal libraries only)](integration-engines-setup-unreal.md)
   + [For Unity projects (C\$1 server SDK for Unity libraries only)](integration-engines-unity-using.md)
   + [For use with the Amazon GameLift Servers plugin for Unreal Engine](unreal-plugin.md)
   + [For use with the Amazon GameLift Servers plugin for Unity](unity-plug-in.md)

1. Update your server code as follows:
   + Change the server code callback function `onCreateGameSession()` to `onStartGameSession()`.
   + Update the `InitSDK()` inputs as appropriate: 
     + If you plan to deploy the game server build to either an Amazon GameLift Servers managed EC2 fleet or an Anywhere fleet with the Amazon GameLift Servers Agent: 

       Call `InitSDK()` with no parameters ([C\$1\$1](integration-server-sdk5-cpp-actions.md#integration-server-sdk5-cpp-initsdk)) ([C\$1](integration-server-sdk5-csharp-actions.md#integration-server-sdk5-csharp-initsdk)) ([Unreal](integration-server-sdk5-unreal-actions.md#integration-server-sdk5-unreal-initsdk)). This call sets up the compute environment and a WebSocket connection to the Amazon GameLift Servers service. 
     + If you plan to deploy the game server build to an Anywhere fleet without the Amazon GameLift Servers Agent:

       Call `InitSDK()` with server parameters ([C\$1\$1](integration-server-sdk5-cpp-actions.md#integration-server-sdk5-cpp-initsdk-anywhere)) ([C\$1](integration-server-sdk5-csharp-actions.md#integration-server-sdk5-csharp-initsdk-anywhere)) ([Unreal](integration-server-sdk5-unreal-actions.md#integration-server-sdk5-unreal-initsdk-anywhere)). A game server process uses these parameters to establish a connection with the Amazon GameLift Servers service.

1. If your game server build or other hosted applications communicate with other AWS resources while running, you'll need to change how the application gets access to those resources. Replace the use of `AssumeRoleCredentials` with the new server SDK action `GetFleetRoleCredentials()` (for game servers) or use shared credentials (for other applications). For more on how to implement this change, see [Connect your Amazon GameLift Servers hosted game server to other AWS resources](gamelift-sdk-server-resources.md).

1. If your project called the server SDK action `GetInstanceCertificate()` to retrieve a TLS certificate, modify your code to use the new `GetComputeCertificate()` ([C\$1\$1](integration-server-sdk5-cpp-actions.md#integration-server-sdk5-cpp-getcomputecertificate)) ([C\$1](integration-server-sdk5-csharp-actions.md#integration-server-sdk5-csharp-getcomputecertificate)) ([Unreal](integration-server-sdk5-unreal-actions.md#integration-server-sdk5-unreal-getcomputecertificate)) instead.

1. When uploading your game build to Amazon GameLift Servers (such as with [upload-build](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/gamelift/upload-build.html) or [CreateBuild()](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_CreateBuild.html)), set the `ServerSdkVersion` parameter to the 5.x version you're using (this parameter currently defaults to 4.0.2). This parameter must match the actual server SDK libraries in the game server build. If you specify the wrong version for an uploaded game server build, any fleets you create with that build will fail. See [Create a game server build for Amazon GameLift Servers](gamelift-build-cli-uploading.md).

   The following example illustrates how to specify the server SDK version: 

   ```
   aws gamelift upload-build \
       --operating-system AMAZON_LINUX_2023 \
       --server-sdk-version "5.0.0" \
       --build-root "~/mygame" \
       --name "My Game Nightly Build" \
       --build-version "build 255" \
       --region us-west-2
   ```

1. If you use scripts to remotely connect to managed fleets, update the scripts to use the new process, as described in [Connect to fleet instances](fleets-remote-access.md).

# 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);
}
```

# C\$1 server SDK 5.x for Amazon GameLift Servers -- Actions
<a name="integration-server-sdk5-csharp-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). If you're using the Amazon GameLift Servers plugin for Unity, see also [Amazon GameLift Servers plugin for Unity (server SDK 5.x)](unity-plug-in.md).

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

Use the Amazon GameLift Servers C\$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). If you're using the Amazon GameLift Servers plugin for Unity, see also [Amazon GameLift Servers plugin for Unity (server SDK 5.x)](unity-plug-in.md).

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

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

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

Use this data type to identify which files generated during a game session that you want the game server to upload to Amazon GameLift Servers after the game session ends. The game server communicates `LogParameters to` Amazon GameLift Servers in a [ProcessReady()](integration-server-sdk5-csharp-actions.md#integration-server-sdk5-csharp-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:** `List<String>` **Required:** No  | 

## MetricsParameters
<a name="integration-server-sdk5-csharp-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-csharp-actions.md#integration-server-sdk5-csharp-initmetrics) call.


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

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

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


|  |  | 
| --- |--- |
|  **Properties**  | Description | 
| LogParameters | The object with a list of directory paths to game session log files.**Type:** `Aws::GameLift::Server::LogParameters`**Required:** Yes | 
| OnHealthCheck | The name of 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. After calling this function Amazon GameLift Servers waits 60 seconds for a response, if none is received, Amazon GameLift Servers records the server process as unhealthy.**Type:** `void OnHealthCheckDelegate()`**Required:** Yes | 
| OnProcessTerminate | The name of callback function that Amazon GameLift Servers invokes to force the server process to shut down. After calling this function, Amazon GameLift Servers waits five minutes for the server process to shut down and respond with a [ProcessEnding()](integration-server-sdk5-csharp-actions.md#integration-server-sdk5-csharp-processending) call before it shuts down the server process.**Type:** `void OnProcessTerminateDelegate()`**Required:** Yes | 
| OnStartGameSession | The name of callback function that Amazon GameLift Servers invokes to activate a new game session. Amazon GameLift Servers calls this function in response to the client request [CreateGameSession](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_CreateGameSession.html). The callback function takes a [GameSession](#integration-server-sdk5-csharp-dataypes-gamesession) object.**Type:** `void OnStartGameSessionDelegate(GameSession)`**Required:** Yes | 
| OnUpdateGameSession | The name of 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-csharp-dataypes-gamesession) object, a status update (updateReason), and the match backfill ticket ID.**Type:** void OnUpdateGameSessionDelegate([UpdateGameSession](#integration-server-sdk5-csharp-dataypes-updategamesession))**Required:** No | 
| Port | The port number that 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-csharp-dataypes-updategamesession"></a>

Updated information for a game session object, includes the reason that the game session was updated. If the update is related to a match backfill action, this data type includes the backfill ticket ID.


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

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

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:** `String` **Required**: No  | 
| Name |  A descriptive label of the game session.  **Type:** `String` **Required**: No  | 
| FleetId |  A unique identifier for the fleet that the game session is running on. **Type:** `String` **Required**: No  | 
| MaximumPlayerSessionCount |  The maximum number of player connections to the game session. **Type:** `Integer` **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:** `Integer` **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:** `String` **Required**: No  | 
| GameSessionData |  A set of custom game session properties, formatted as a single string value.  **Type:** `String` **Required**: No  | 
| MatchmakerData |  The information about the matchmaking process that was used to create the game session, in JSON syntax, formatted as a string. In addition the matchmaking configuration used, it contains data on all players assigned to the match, including player attributes and team assignments. **Type:** `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:** `Dictionary<string, string>` **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-csharp-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:** `String` **Required**: No  | 

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

Information used to maintain the connection between an Amazon GameLift Servers Anywhere server and the Amazon GameLift Servers service. This information is used when launching new server processes with [InitSDK()](integration-server-sdk5-csharp-actions.md#integration-server-sdk5-csharp-initsdk). For servers hosted on Amazon GameLift Servers managed EC2 instances, use an empty object.


| Properties | **Description** | 
| --- | --- | 
| WebSocketUrl |  The `GameLiftServerSdkEndpoint` returned when you `RegisterCompute` as part of Amazon GameLift Servers Anywhere. **Type:** `String` **Required**: Yes  | 
| ProcessId |  A unique identifier registered to the server process hosting your game. **Type:** `String` **Required**: Yes  | 
| HostId |  A unique identifier for the host with the server processes hosting your game. 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:** `String` **Required**: Yes  | 
| FleetId | The fleet ID 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:** `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:** `String`**Required**: Yes | 

## StartMatchBackfillRequest
<a name="integration-server-sdk5-csharp-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-csharp-actions.md#integration-server-sdk5-csharp-startmatchbackfill) call.


| Properties | **Description** | 
| --- | --- | 
| GameSessionArn |  The unique game session identifier. The API operation `[GetGameSessionId](https://docs.aws.amazon.com/gameliftservers/latest/developerguide/integration-server-sdk5-csharp-actions.html#integration-server-sdk5-csharp-getgamesessionid)` returns the identifier in ARN format. **Type:** `String` **Required**: Yes  | 
| MatchmakingConfigurationArn |  The 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:** `String` **Required**: Yes  | 
| Players |  A set of data that represents all players who are currently in the game session. The matchmaker uses this information to search for new players who are good matches for the current players. **Type:** `List<Player>` **Required**: Yes  | 
| TicketId |  The 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:** `String` **Required**: No  | 

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

Represents a player in matchmaking. When a matchmaking request starts, 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 that contain 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:** `Dictionary<string, AttributeValue` **Required**: No  | 
| PlayerId |  A unique identifier for a player. **Type:** `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:** `String` **Required**: No  | 

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

This data type is used to specify which player session(s) to retrieve. It can be used in several ways: (1) provide a PlayerSessionId to request a specific player session; (2) provide a GameSessionId to request all player sessions in the specified game session; or (3) provide a PlayerId to request all player sessions for the specified player. For large collections of player sessions, use the pagination parameters to retrieve results as sequential pages.


| Properties | **Description** | 
| --- | --- | 
| GameSessionId |  The unique game session identifier. Use this parameter to request all player sessions for the specified game session. Game session ID format is as follows: `arn:aws:gamelift:<region>::gamesession/fleet-<fleet ID>/<ID string>`. The value of <ID string> is either a custom ID string (if one was specified when the game session was created) a generated string.  **Type:** `String` **Required**: No  | 
| PlayerSessionId |  The unique identifier for a player session. **Type:** `String` **Required**: No  | 
| PlayerId |  The unique identifier for a player. See [Generate player IDs](player-sessions-player-identifiers.md). **Type:** `String` **Required**: No  | 
| PlayerSessionStatusFilter |  The player session status to filter results on. Possible player session statuses include the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/gameliftservers/latest/developerguide/integration-server-sdk5-csharp-datatypes.html) **Type:** `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:** `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-csharp-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-csharp-actions.md#integration-server-sdk5-csharp-stopmatchbackfill) call.


| Properties | **Description** | 
| --- | --- | 
| GameSessionArn |  The unique game session identifier of the request being canceled. **Type:** `string` **Required**: Yes  | 
| MatchmakingConfigurationArn |  The unique identifier of the matchmaker this request was sent to. **Type:** `string` **Required**: Yes  | 
| TicketId |  The unique identifier of the backfill request ticket to be canceled. **Type:** `string` **Required**: Yes  | 

## GetFleetRoleCredentialsRequest
<a name="integration-server-sdk5-csharp-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:** `string` **Required**: Yes  | 
| RoleSessionName | The name of the session that describes the use of the role credentials. **Type:** `string` **Required**: No  | 

## AttributeValue
<a name="integration-server-sdk5-csharp-datatypes-attributevalue"></a>

Use these values in [Player](#integration-server-sdk5-csharp-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 can use only one of the available properties.


| Properties | Description | 
| --- | --- | 
| attrType |  Specifies the type of attribute value. **Type:** An `AttrType` [enum](#integration-server-sdk5-csharp-datatypes-enums) value.  **Required:** No  | 
| S |  Represents a string attribute value. **Type:** `string` **Required:** Yes  | 
| N |  Represents a numeric attribute value. **Type:** `double` **Required:** Yes  | 
| SL |  Represents an array of string attribute values. **Type:** `string[]` **Required:** Yes  | 
| SDM |  Represents a dictionary of string keys and double values. **Type:** `Dictionary<string, double>` **Required:** Yes  | 

## AwsStringOutcome
<a name="integration-server-sdk5-csharp-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:** `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-gamelifterror) **Required:** No  | 

## GenericOutcome
<a name="integration-server-sdk5-csharp-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-csharp-datatypes-gamelifterror) **Required:** No  | 

## MetricsManagerOutcome
<a name="integration-server-sdk5-csharp-datatypes-metricsmanageroutcome"></a>

Represents the result of an [InitMetrics()](integration-server-sdk5-csharp-actions.md#integration-server-sdk5-csharp-initmetrics) call. Contains either a MetricsManager instance on success or error information on failure.


|  |  | 
| --- |--- |
| Result |  The MetricsManager instance for collecting and reporting metrics. **Type:** `MetricsManager` **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-gamelifterror) **Required:** No  | 

## DescribePlayerSessionsOutcome
<a name="integration-server-sdk5-csharp-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-csharp-datatypes-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-csharp-datatypes-gamelifterror) **Required:** No  | 

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


| Properties | Description | 
| --- | --- | 
| 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:** `string` **Required:** Yes  | 
| PlayerSessions |  A collection of objects containing properties for each player session that matches the request.  **Type:** `IList<PlayerSession>` **Required:**   | 
| 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-gamelifterror) **Required:** No  | 

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


| Properties | Description | 
| --- | --- | 
| CreationTime |  **Type:** `long` **Required:** Yes  | 
| FleetId |  **Type:** `string` **Required:** Yes  | 
| GameSessionId |  **Type:** `string` **Required:** Yes  | 
| IpAddress |  **Type:** `string` **Required:** Yes  | 
| PlayerData |  **Type:** `string` **Required:** Yes  | 
| PlayerId |  **Type:** `string` **Required:** Yes  | 
| PlayerSessionId |  **Type:** `string` **Required:** Yes  | 
| Port |  **Type:** `int` **Required:** Yes  | 
| Status |  **Type:** A `PlayerSessionStatus` [enum](#integration-server-sdk5-csharp-datatypes-enums). **Required:** Yes  | 
| TerminationTime |  **Type:** `long` **Required:** Yes  | 
| DnsName |  **Type:** `string` **Required:** Yes  | 

## StartMatchBackfillOutcome
<a name="integration-server-sdk5-csharp-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-csharp-datatypes-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-csharp-datatypes-gamelifterror) **Required:** No  | 

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


| Properties | Description | 
| --- | --- | 
| TicketId |  **Type:** `string` **Required:** Yes  | 

## GetComputeCertificateOutcome
<a name="integration-server-sdk5-csharp-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-csharp-datatypes-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-csharp-datatypes-gamelifterror) **Required:** No  | 

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

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


| Properties | Description | 
| --- | --- | 
| CertificatePath |  **Type:** `string` **Required:** Yes  | 
| ComputeName |  **Type:** `string` **Required:** Yes  | 

## GetFleetRoleCredentialsOutcome
<a name="integration-server-sdk5-csharp-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-csharp-datatypes-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-csharp-datatypes-gamelifterror) **Required:** No  | 

## GetFleetRoleCredentialsResult
<a name="integration-server-sdk5-csharp-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-gamelifterror) **Required:** No  | 

## AwsDateTimeOutcome
<a name="integration-server-sdk5-csharp-datatypes-awsdatetimeoutcome"></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:** `DateTime` **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-gamelifterror) **Required:** No  | 

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


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

## Enums
<a name="integration-server-sdk5-csharp-datatypes-enums"></a>

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

**AttrType**  
+ **NONE**
+ **STRING**
+ **DOUBLE**
+ **STRING\$1LIST**
+ **STRING\$1DOUBLE\$1MAP**

**GameLiftErrorType**  
String value indicating the error type. Valid values include:  
+ **SERVICE\$1CALL\$1FAILED** – A call to an AWS service has failed. 
+ **LOCAL\$1CONNECTION\$1FAILED** – The local connection to Amazon GameLift Servers failed. 
+ **NETWORK\$1NOT\$1INITIALIZED** – The network has not been initialized. 
+ **GAMESESSION\$1ID\$1NOT\$1SET** – The game session ID has not been set. 
+ **BAD\$1REQUEST\$1EXCEPTION** 
+ **INTERNAL\$1SERVICE\$1EXCEPTION** 
+ **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. 

**PlayerSessionStatus**  
+ **ACTIVE**
+ **COMPLETED**
+ **NOT\$1SET**
+ **RESERVED**
+ **TIMEDOUT**

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

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

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

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

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

```
AwsStringOutcome GetSdkVersion();
```

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

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

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

```
var getSdkVersionOutcome = GameLiftServerAPI.GetSdkVersion();
```

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

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

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

```
MetricsManagerOutcome InitMetrics();
MetricsManagerOutcome InitMetrics(MetricsParameters metricsParameters);
```

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

[MetricsParameters](integration-server-sdk5-csharp-datatypes.md#integration-server-sdk5-csharp-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-csharp-initmetrics-return"></a>

If successful, returns a [MetricsManagerOutcome](integration-server-sdk5-csharp-datatypes.md#integration-server-sdk5-csharp-datatypes-metricsmanageroutcome) object containing the MetricsManager instance. If not successful, returns an error message.

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

```
// Initialize with default parameters (uses environment variables if available)
var outcome = GameLiftServerAPI.InitMetrics();
if (outcome.Success) {
    var metricsManager = outcome.Result;
} else {
    Console.WriteLine("Failed to initialize metrics: " + outcome.Error.ErrorMessage);
}

// Initialize with custom parameters
var metricsParams = new MetricsParameters("localhost", 8125, "crash-host", 9999, 1000, 1024);
var customOutcome = GameLiftServerAPI.InitMetrics(metricsParams);
if (customOutcome.Success) {
    var metricsManager = customOutcome.Result;
}
```

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

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

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

```
GenericOutcome InitSDK();
```

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

If successful, returns an InitSdkOutcome object to indicate that the server process is ready to call [ProcessReady()](#integration-server-sdk5-csharp-processready). 

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

```
//Call InitSDK to establish a local connection with the GameLift agent to enable further communication.
GenericOutcome initSDKOutcome = GameLiftServerAPI.InitSDK();
```

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

Initializes the Amazon GameLift Servers SDK for an Anywhere fleet. Call this method on launch, before any other initialization related to Amazon GameLift Servers occurs. This method requires explicit server parameters to set up communication between the server and the Amazon GameLift Servers service. It uses an idempotency token, so you safely retry this call when it fails.

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

```
GenericOutcome InitSDK(ServerParameters serverParameters);
```

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

[ServerParameters](integration-server-sdk5-csharp-datatypes.md#integration-server-sdk5-csharp-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-csharp-initsdk-anywhere-return"></a>

If successful, returns an InitSdkOutcome object to indicate that the server process is ready to call [ProcessReady()](#integration-server-sdk5-csharp-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-csharp-initsdk-anywhere-example"></a>

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

//Call InitSDK to establish a local connection with the GameLift agent to enable further communication.
GenericOutcome initSDKOutcome = GameLiftServerAPI.InitSDK(serverParameters);
```

## ProcessReady()
<a name="integration-server-sdk5-csharp-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-csharp-initsdk). This method should be called only once per process.

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

```
GenericOutcome ProcessReady(ProcessParameters processParameters)
```

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

**[ProcessParameters](integration-server-sdk5-csharp-datatypes.md#integration-server-sdk5-csharp-dataypes-process)**  
A `ProcessParameters` object holds information about the server process.

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

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

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

This example illustrates both the method and delegate function implementations.

```
// Set parameters and call ProcessReady
ProcessParameters processParams = new ProcessParameters(
  this.OnStartGameSession,
  this.OnProcessTerminate,
  this.OnHealthCheck,
  this.OnUpdateGameSession,
  port,
  new LogParameters(new List<string>()  
  // Examples of log and error files written by the game server
  {
    "C:\\game\\logs",
    "C:\\game\\error"
  })
);
GenericOutcome processReadyOutcome = GameLiftServerAPI.ProcessReady(processParams);
```

## ProcessEnding()
<a name="integration-server-sdk5-csharp-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-csharp-processending-syntax"></a>

```
GenericOutcome ProcessEnding()
```

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

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

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

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

```
GenericOutcome processEndingOutcome = GameLiftServerAPI.ProcessEnding();
GameLiftServerAPI.Destroy();

if (processEndingOutcome.Success)
  {
    Environment.Exit(0);
  }
else
  {
    Console.WriteLine("ProcessEnding() failed. Error: " + processEndingOutcome.Error.ToString());
    Environment.Exit(-1);  
  }
```

## ActivateGameSession()
<a name="integration-server-sdk5-csharp-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-csharp-activategamesession-syntax"></a>

```
GenericOutcome ActivateGameSession()
```

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

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

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

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

```
void OnStartGameSession(GameSession gameSession)
{
  // game-specific tasks when starting a new game session, such as loading map   
  // When ready to receive players   
  GenericOutcome activateGameSessionOutcome = GameLiftServerAPI.ActivateGameSession();
}
```

## UpdatePlayerSessionCreationPolicy()
<a name="integration-server-sdk5-csharp-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-csharp-updateplayersessioncreationpolicy-syntax"></a>

```
GenericOutcome UpdatePlayerSessionCreationPolicy(PlayerSessionCreationPolicy playerSessionPolicy)
```

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

**playerSessionPolicy**  
String value that indicates whether the game session accepts new players.   
Valid values include:  
+ **ACCEPT\$1ALL** – Accept all new player sessions.
+ **DENY\$1ALL** – Deny all new player sessions.

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

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

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

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

```
GenericOutcome updatePlayerSessionPolicyOutcome = 
  GameLiftServerAPI.UpdatePlayerSessionCreationPolicy(PlayerSessionCreationPolicy.ACCEPT_ALL);
```

## GetGameSessionId()
<a name="integration-server-sdk5-csharp-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-csharp-datatypes.md#integration-server-sdk5-csharp-datatypes-gamelifterror).

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

```
AwsStringOutcome GetGameSessionId()
```

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

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

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

```
AwsStringOutcome getGameSessionIdOutcome = GameLiftServerAPI.GetGameSessionId();
```

## GetTerminationTime()
<a name="integration-server-sdk5-csharp-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 this 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-csharp-getterm-syntax"></a>

```
AwsDateTimeOutcome GetTerminationTime()
```

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

If successful, returns the termination time as an [AwsDateTimeOutcome](integration-server-sdk5-csharp-datatypes.md#integration-server-sdk5-csharp-datatypes-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.

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

```
AwsDateTimeOutcome getTerminationTimeOutcome = GameLiftServerAPI.GetTerminationTime(); 
```

## AcceptPlayerSession()
<a name="integration-server-sdk5-csharp-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-csharp-acceptplayersession-syntax"></a>

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

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

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

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

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

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

This example illustrates a function for handling a connection request, including validating and rejecting invalid player session IDs. 

```
void ReceiveConnectingPlayerSessionID (Connection connection, String playerSessionId)
{
  GenericOutcome acceptPlayerSessionOutcome = GameLiftServerAPI.AcceptPlayerSession(playerSessionId);
  if(acceptPlayerSessionOutcome.Success)
  {
    connectionToSessionMap.emplace(connection, playerSessionId);
    connection.Accept();
  }
  else 
  {
    connection.Reject(acceptPlayerSessionOutcome.Error.ErrorMessage);
  }       
}
```

## RemovePlayerSession()
<a name="integration-server-sdk5-csharp-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-csharp-removeplayersession-syntax"></a>

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

### Parameters
<a name="integration-server-sdk5-csharp-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-csharp-removeplayersession-return"></a>

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

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

```
GenericOutcome removePlayerSessionOutcome = GameLiftServerAPI.RemovePlayerSession(playerSessionId);
```

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

Retrieves player session data which includes settings, session metadata, and player data. Use this action to get information for a single player session, for all player sessions in a game session, or for all player sessions associated with a single player ID.

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

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

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

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

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

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

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

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

```
// Set request parameters 
DescribePlayerSessionsRequest describePlayerSessionsRequest = new DescribePlayerSessionsRequest()
{
  GameSessionId = GameLiftServerAPI.GetGameSessionId().Result,    //gets the ID for the current game session
  Limit = 10,
  PlayerSessionStatusFilter = 
    PlayerSessionStatusMapper.GetNameForPlayerSessionStatus(PlayerSessionStatus.ACTIVE)
}; 
// Call DescribePlayerSessions
DescribePlayerSessionsOutcome describePlayerSessionsOutcome = 
  GameLiftServerAPI.DescribePlayerSessions(describePlayerSessionsRequest);
```

## StartMatchBackfill()
<a name="integration-server-sdk5-csharp-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-csharp-stopmatchbackfill) to cancel the original request.

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

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

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

**[StartMatchBackfillRequest](integration-server-sdk5-csharp-datatypes.md#integration-server-sdk5-csharp-dataypes-startmatchbackfillrequest)**  
A `StartMatchBackfillRequest` object holds information about the backfill request.

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

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

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

```
// Build a backfill request
StartMatchBackfillRequest startBackfillRequest = new StartMatchBackfillRequest()
{
  TicketId = "1111aaaa-22bb-33cc-44dd-5555eeee66ff", //optional
  MatchmakingConfigurationArn = "arn:aws:gamelift:us-west-2:111122223333:matchmakingconfiguration/MyMatchmakerConfig", 
  GameSessionId = GameLiftServerAPI.GetGameSessionId().Result,    // gets ID for current game session
  MatchmakerData matchmakerData = 
    MatchmakerData.FromJson(gameSession.MatchmakerData),  // gets matchmaker data for current players
  // get matchmakerData.Players
  // remove data for players who are no longer connected
  Players = ListOfPlayersRemainingInTheGame
};

// Send backfill request
StartMatchBackfillOutcome startBackfillOutcome = GameLiftServerAPI.StartMatchBackfill(startBackfillRequest);

// Implement callback function for backfill
void OnUpdateGameSession(GameSession myGameSession)
{
  // game-specific tasks to prepare for the newly matched players and update matchmaker data as needed  
}
```

## StopMatchBackfill()
<a name="integration-server-sdk5-csharp-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-csharp-stopmatchbackfill-syntax"></a>

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

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

**[StopMatchBackfillRequest](integration-server-sdk5-csharp-datatypes.md#integration-server-sdk5-csharp-dataypes-stopmatchbackfillrequest)**  
A `StopMatchBackfillRequest` object that provides details about the matchmaking ticket you are stopping.

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

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

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

```
// Set backfill stop request parameters
StopMatchBackfillRequest stopBackfillRequest = new StopMatchBackfillRequest(){
  TicketId = "1111aaaa-22bb-33cc-44dd-5555eeee66ff", //optional, if not provided one is autogenerated
  MatchmakingConfigurationArn = "arn:aws:gamelift:us-west-2:111122223333:matchmakingconfiguration/MyMatchmakerConfig",
  GameSessionId = GameLiftServerAPI.GetGameSessionId().Result    //gets the ID for the current game session
};
GenericOutcome stopBackfillOutcome = GameLiftServerAPI.StopMatchBackfillRequest(stopBackfillRequest);
```

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

 Retrieves the path to the TLS certificate used to encrypt the network connection between the game server and your game client. 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-csharp-getcomputecertificate-syntax"></a>

```
GetComputeCertificateOutcome GetComputeCertificate();
```

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

Returns a GetComputeCertificateResponse object that contains the following: 
+  CertificatePath: The path to the TLS certificate on your compute resource. When using an Amazon GameLift Servers managed fleet, this path contains:
  + `certificate.pem`: The end-user certificate. The full certificate chain is the combination of `certificateChain.pem` appended to this certificate.
  + `certificateChain.pem`: The certificate chain that contains the root certificate and intermediate certificates.
  + `rootCertificate.pem`: The root certificate.
  + `privateKey.pem`: The private key for the end-user certificate.
+ ComputeName: The name of your compute resource.

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

```
GetComputeCertificateOutcome getComputeCertificateOutcome = GameLiftServerAPI.GetComputeCertificate();
```

## GetFleetRoleCredentials()
<a name="integration-server-sdk5-csharp-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-csharp-getfleetrolecredentials-syntax"></a>

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

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

[GetFleetRoleCredentialsRequest](integration-server-sdk5-csharp-datatypes.md#integration-server-sdk5-csharp-dataypes-getfleetrolecredentialsrequest)  
Role credentials that extend limited access to your AWS resources to the game server.

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

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

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

```
// form the fleet credentials request  
GetFleetRoleCredentialsRequest getFleetRoleCredentialsRequest = new GetFleetRoleCredentialsRequest(){  
  RoleArn = "arn:aws:iam::123456789012:role/service-role/exampleGameLiftAction"  
};
GetFleetRoleCredentialsOutcome GetFleetRoleCredentialsOutcome credentials = GetFleetRoleCredentials(getFleetRoleCredentialsRequest);
```

## Destroy()
<a name="integration-server-sdk5-csharp-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-csharp-destroy-syntax"></a>

```
GenericOutcome Destroy()
```

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

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

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

```
// Operations to end game sessions and the server process
GenericOutcome processEndingOutcome = GameLiftServerAPI.ProcessEnding();

// Shut down and destroy the instance of the GameLift Game Server SDK
GenericOutcome destroyOutcome = GameLiftServerAPI.Destroy();

// Exit the process with success or failure
if (processEndingOutcome.Success)
  { 
    Environment.Exit(0); 
  }
else
  {
    Console.WriteLine("ProcessEnding() failed. Error: " + processEndingOutcome.Error.ToString());
    Environment.Exit(-1); 
  }
```

# Go server SDK for Amazon GameLift Servers -- Actions
<a name="integration-server-sdk-go-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).

`GameLiftServerAPI.go` defines the Go server SDK actions.

# Go server SDK for Amazon GameLift Servers -- Data types
<a name="integration-server-sdk-go-datatypes"></a>

Use the server SDK 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).

`GameLiftServerAPI.go` defines the Go server SDK actions.

[Go server SDK for Amazon GameLift Servers -- Actions](integration-server-sdk-go-actions.md)

**Topics**
+ [LogParameters](#integration-server-sdk-go-dataypes-log)
+ [MetricsParameters](#integration-server-sdk-go-dataypes-metrics)
+ [ProcessParameters](#integration-server-sdk-go-dataypes-process)
+ [UpdateGameSession](#integration-server-sdk-go-dataypes-updategamesession)
+ [GameSession](#integration-server-sdk-go-dataypes-gamesession)
+ [ServerParameters](#integration-server-sdk-go-dataypes-serverparameters)
+ [StartMatchBackfillRequest](#integration-server-sdk-go-dataypes-startmatchbackfillrequest)
+ [Player](#integration-server-sdk-go-dataypes-player)
+ [DescribePlayerSessionsRequest](#integration-server-sdk-go-dataypes-playersessions)
+ [StopMatchBackfillRequest](#integration-server-sdk-go-dataypes-stopmatchbackfillrequest)
+ [GetFleetRoleCredentialsRequest](#integration-server-sdk-go-dataypes-getfleetrolecredentialsrequest)

## LogParameters
<a name="integration-server-sdk-go-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-sdk-go-actions.md#integration-server-sdk-go-processready) call.


|  |  | 
| --- |--- |
|  **Properties**  | Description | 
| LogPaths |  The list of directory paths to game server log files that 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 such as `MyGame\sessionLogs\`, then the path would be `c:\game\MyGame\sessionLogs` on a Windows instance. **Type:** `[]string` **Required:** No  | 

## MetricsParameters
<a name="integration-server-sdk-go-dataypes-metrics"></a>

An object communicating configuration parameters for initializing the metrics system. This configuration is used to set up StatsD reporting, crash reporting, and metrics processing behavior. The game server provides `MetricsParameters` to Amazon GameLift Servers as part of a [InitMetrics()](integration-server-sdk-go-actions.md#integration-server-sdk-go-initmetrics) call.


|  |  | 
| --- |--- |
|  **Properties**  | Description | 
| StatsdHost |  The StatsD server host for metrics reporting (e.g., "localhost"). **Type:** `string` **Required:** Yes  | 
| StatsdPort |  The StatsD server port for metrics reporting (e.g., 8125). **Type:** `int` **Required:** Yes  | 
| CrashReporterHost |  The crash reporter host for crash tracking and process monitoring. **Type:** `string` **Required:** Yes  | 
| CrashReporterPort |  The crash reporter port for crash tracking and process monitoring. **Type:** `int` **Required:** Yes  | 
| FlushIntervalMs |  The metrics flush interval in milliseconds. Controls how frequently metrics are sent to StatsD. **Type:** `int` **Required:** Yes  | 
| MaxPacketSize |  The maximum packet size for metrics in bytes. Limits the size of UDP packets sent to StatsD. **Type:** `int` **Required:** Yes  | 

## ProcessParameters
<a name="integration-server-sdk-go-dataypes-process"></a>

An object describing the communication between a server process and Amazon GameLift Servers. The server process provides this information to Amazon GameLift Servers with a call to [ProcessReady()](integration-server-sdk-go-actions.md#integration-server-sdk-go-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:** `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:** `OnHealthCheck func() bool`**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-sdk-go-actions.md#integration-server-sdk-go-processending) call before it shuts down the server process.**Type:** `OnProcessTerminate func()`**Required:** Yes | 
| OnStartGameSession | 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-sdk-go-dataypes-gamesession) object, a status update (updateReason), and the match backfill ticket ID.**Type:** `OnStartGameSession func (model.GameSession )`**Required:** Yes | 
| OnUpdateGameSession | The callback function that Amazon GameLift Servers invokes to pass updated game session information to the server process. Amazon GameLift Servers calls this function after processing a match backfill request to provide updated matchmaker data. **Type:** `OnUpdateGameSession func (model.UpdateGameSession)`**Required:** No | 
| Port | The port number that 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:** `int`**Required:** Yes | 

## UpdateGameSession
<a name="integration-server-sdk-go-dataypes-updategamesession"></a>

The 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 being used to fill player sessions in the game session.


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

## GameSession
<a name="integration-server-sdk-go-dataypes-gamesession"></a>

The details of a game session. 


| Properties | **Description** | 
| --- | --- | 
| GameSessionId |  A unique identifier for the game session. A game session Amazon Resource Name (ARN) has the following format: `arn:aws:gamelift:<region>::gamesession/<fleet ID>/<custom ID string or idempotency token>`. **Type:** `String` **Required**: No  | 
| Name |  A descriptive label of the game session.  **Type:** `String` **Required**: No  | 
| FleetId |  A unique identifier for the fleet that the game session is running on. **Type:** `String` **Required**: No  | 
| MaximumPlayerSessionCount |  The maximum number of player connections to the game session. **Type:** `Integer` **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:** `Integer` **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:** `String` **Required**: No  | 
| GameSessionData |  A set of custom game session properties, formatted as a single string value.  **Type:** `String` **Required**: No  | 
| MatchmakerData |  The 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:** `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:** `map[string] string` **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-sdk-go-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:** `String` **Required**: No  | 

## ServerParameters
<a name="integration-server-sdk-go-dataypes-serverparameters"></a>

Information used to maintain the connection between an Amazon GameLift Servers Anywhere server and the Amazon GameLift Servers service. This information is used when launching new server processes with [InitSDK()](integration-server-sdk-go-actions.md#integration-server-sdk-go-initsdk). For servers hosted on Amazon GameLift Servers managed EC2 instances, use an empty object.


| 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 an Amazon GameLift Servers Anywhere compute resource. **Type:** `string` **Required**: Yes  | 
| ProcessID |  A unique identifier registered to the server process hosting your game. **Type:** `string` **Required**: Yes  | 
| HostID |  The unique identifier of the compute resource that's hosting the new server process.  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:** `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:** `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:** `string`**Required**: Yes | 

## StartMatchBackfillRequest
<a name="integration-server-sdk-go-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-sdk-go-actions.md#integration-server-sdk-go-startmatchbackfill) call.


| Properties | **Description** | 
| --- | --- | 
| GameSessionArn |  The unique game session identifier. The API operation `[GetGameSessionId](https://docs.aws.amazon.com/gameliftservers/latest/developerguide/integration-server-sdk-go-actions.html#integration-server-sdk-go-getgamesessionid)` returns the identifier in ARN format. **Type:** `String` **Required**: Yes  | 
| MatchmakingConfigurationArn |  The 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. For more information about matchmaker data, see [Work with matchmaker data](https://docs.aws.amazon.com/gameliftservers/latest/flexmatchguide/match-server.html#match-server-data.html). **Type:** `String` **Required**: Yes  | 
| Players |  A set of data that represents all players who are currently in the game session. The matchmaker uses this information to search for new players who are good matches for the current players. **Type:** `[]model.Player` **Required**: Yes  | 
| TicketId |  The 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:** `String` **Required**: No  | 

## Player
<a name="integration-server-sdk-go-dataypes-player"></a>

The object that represents a player in matchmaking. When a matchmaking request starts, 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:** `map[string] int` **Required**: No  | 
| PlayerAttributes |  A collection of key:value pairs that contain 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:** `map[string] AttributeValue` **Required**: No  | 
| PlayerId |  A unique identifier for a player. **Type:** `String` **Required**: No  | 
| Team |  The name of the team that the player is assigned to in a match. You define the team name in the matchmaking rule set. **Type:** `String` **Required**: No  | 

## DescribePlayerSessionsRequest
<a name="integration-server-sdk-go-dataypes-playersessions"></a>

An object that specifies which player sessions to retrieve. The server process provides this information with a [DescribePlayerSessions()](integration-server-sdk-go-actions.md#integration-server-sdk-go-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 generated string.  **Type:** `String` **Required**: No  | 
| PlayerSessionID |  The unique identifier for a player session. Use this parameter to request a single specific player session. **Type:** `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:** `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-sdk-go-datatypes.html) **Type:** `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:** `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-sdk-go-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-sdk-go-actions.md#integration-server-sdk-go-stopmatchbackfill) call.


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

## GetFleetRoleCredentialsRequest
<a name="integration-server-sdk-go-dataypes-getfleetrolecredentialsrequest"></a>

The role credentials that extend limited access to your AWS resources to the game server. For more information see, [Set up an IAM service role for Amazon GameLift Servers](setting-up-role.md).


| Properties | **Description** | 
| --- | --- | 
| RoleArn | The ARN of the service role that extends limited access to your AWS resources.**Type:** `string`**Required**: Yes | 
| RoleSessionName | The name of the session that describes the use of the role credentials.**Type:** `string`**Required:** Yes | 

[Go server SDK for Amazon GameLift Servers -- Data types](integration-server-sdk-go-datatypes.md)

**Topics**
+ [Go server SDK for Amazon GameLift Servers -- Data types](integration-server-sdk-go-datatypes.md)
+ [GetSdkVersion()](#integration-server-sdk-go-getsdkversion)
+ [InitMetrics()](#integration-server-sdk-go-initmetrics)
+ [InitMetricsFromEnvironment()](#integration-server-sdk-go-initmetricsfromenv)
+ [InitSDK()](#integration-server-sdk-go-initsdk)
+ [ProcessReady()](#integration-server-sdk-go-processready)
+ [ProcessEnding()](#integration-server-sdk-go-processending)
+ [ActivateGameSession()](#integration-server-sdk-go-activategamesession)
+ [UpdatePlayerSessionCreationPolicy()](#integration-server-sdk-go-updateplayersessioncreationpolicy)
+ [GetGameSessionId()](#integration-server-sdk-go-getgamesessionid)
+ [GetTerminationTime()](#integration-server-sdk-go-getterm)
+ [AcceptPlayerSession()](#integration-server-sdk-go-acceptplayersession)
+ [RemovePlayerSession()](#integration-server-sdk-go-removeplayersession)
+ [DescribePlayerSessions()](#integration-server-sdk-go-describeplayersessions)
+ [StartMatchBackfill()](#integration-server-sdk-go-startmatchbackfill)
+ [StopMatchBackfill()](#integration-server-sdk-go-stopmatchbackfill)
+ [GetComputeCertificate()](#integration-server-sdk-go-getcomputecertificate)
+ [GetFleetRoleCredentials()](#integration-server-sdk-go-getfleetrolecredentials)
+ [Destroy()](#integration-server-sdk-go-destroy)

## GetSdkVersion()
<a name="integration-server-sdk-go-getsdkversion"></a>

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

### Syntax
<a name="integration-server-sdk-go-getsdkversion-syntax"></a>

```
func GetSdkVersion() (string, error)
```

### Return value
<a name="integration-server-sdk-go-getsdkversion-return"></a>

If successful, returns the current SDK version as a string. The returned string includes the version number (example `5.0.0`). If not successful, returns an error message such as `common.SdkVersionDetectionFailed`.

### Example
<a name="integration-server-sdk-go-getsdkversion-example"></a>

```
version, err := server.GetSdkVersion()
```

## InitMetrics()
<a name="integration-server-sdk-go-initmetrics"></a>

Initializes metrics collection for the Amazon GameLift Servers SDK. This method sets up metrics reporting to help monitor server performance and health. Call this method after [InitSDK()](#integration-server-sdk-go-initsdk) but before [ProcessReady()](#integration-server-sdk-go-processready).

### Syntax
<a name="integration-server-sdk-go-initmetrics-syntax"></a>

```
func InitMetrics() error
func InitMetrics(metricsParameters MetricsParameters) error
```

### Parameters
<a name="integration-server-sdk-go-initmetrics-parameter"></a>

MetricsParameters (optional)  
A `MetricsParameters` object that configures metrics collection. If not provided, default metrics configuration is used. The MetricsParameters structure contains the following fields:  
+ `StatsdHost` - The hostname or IP address of the StatsD server.
+ `StatsdPort` - The port number for the StatsD server.
+ `CrashReporterHost` - The hostname or IP address of the crash reporter service.
+ `CrashReporterPort` - The port number for the crash reporter service.
+ `FlushIntervalMs` - The interval in milliseconds for flushing metrics data.
+ `MaxPacketSize` - The maximum size of metrics packets in bytes.
For more information about the MetricsParameters structure, see [Server SDK 5.x for C\$1 data types](https://docs.aws.amazon.com/gameliftservers/latest/developerguide/integration-server-sdk5-csharp-datatypes.html).

### Return value
<a name="integration-server-sdk-go-initmetrics-return"></a>

If successful, returns `nil` error to indicate that metrics collection has been initialized successfully.

### Example
<a name="integration-server-sdk-go-initmetrics-example"></a>

Initialize metrics with default configuration:

```
err := server.InitMetrics()
```

Initialize metrics with custom configuration:

```
metricsParams := MetricsParameters{
    StatsdHost:        "localhost",
    StatsdPort:        8125,
    CrashReporterHost: "localhost",
    CrashReporterPort: 9125,
    FlushIntervalMs:   5000,
    MaxPacketSize:     1024,
}

err := server.InitMetrics(metricsParams)
```

## InitMetricsFromEnvironment()
<a name="integration-server-sdk-go-initmetricsfromenv"></a>

Initializes metrics collection for the Amazon GameLift Servers SDK using configuration from environment variables. This method sets up metrics reporting using default settings derived from the runtime environment.

Call this method after [InitSDK()](#integration-server-sdk-go-initsdk) but before [ProcessReady()](#integration-server-sdk-go-processready).

### Syntax
<a name="integration-server-sdk-go-initmetricsfromenv-syntax"></a>

```
func InitMetricsFromEnvironment() error
```

### Return value
<a name="integration-server-sdk-go-initmetricsfromenv-return"></a>

If successful, returns `nil` error to indicate that metrics collection has been initialized successfully using environment configuration.

### Example
<a name="integration-server-sdk-go-initmetricsfromenv-example"></a>

```
err := server.InitMetricsFromEnvironment()
```

## InitSDK()
<a name="integration-server-sdk-go-initsdk"></a>

Initializes the Amazon GameLift Servers SDK. Call this method on launch before any other initialization related to Amazon GameLift Servers occurs. This method sets up communication between the server and the Amazon GameLift Servers service.

### Syntax
<a name="integration-server-sdk-go-initsdk-syntax"></a>

```
func InitSDK(params ServerParameters) error 
```

### Parameters
<a name="integration-server-sdk-go-initsdk-parameter"></a>

[ServerParameters](integration-server-sdk-go-datatypes.md#integration-server-sdk-go-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. 
To initialize a game server on an Amazon GameLift Servers managed EC2 fleet, construct a `ServerParameters` object with no parameters. With this call, the Amazon GameLift Servers agent sets up the compute environment and automatically connects to the Amazon GameLift Servers service for you. 

### Return value
<a name="integration-server-sdk-go-initsdk-return"></a>

If successful, returns `nil` error to indicate that the server process is ready to call [ProcessReady()](#integration-server-sdk-go-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-sdk-go-initsdk-example"></a>

Amazon GameLift Servers Anywhere example

```
//Define the server parameters
serverParameters := ServerParameters {
  WebSocketURL: "wss://us-west-1.api.amazongamelift.com",
  ProcessID: "PID1234",
  HostID: "HardwareAnywhere",
  FleetID: "aarn:aws:gamelift:us-west-1:111122223333:fleet/fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
  AuthToken: "1111aaaa-22bb-33cc-44dd-5555eeee66ff"
}

//Call InitSDK to establish a local connection with the Amazon GameLift Servers Agent to enable further communication.
err := server.InitSDK(serverParameters)
```

Amazon GameLift Servers managed EC2 example

```
//Define the server parameters
serverParameters := ServerParameters {}

//Call InitSDK to establish a local connection with the Amazon GameLift Servers Agent to enable further communication.
err := server.InitSDK(serverParameters)
```

## ProcessReady()
<a name="integration-server-sdk-go-processready"></a>

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

### Syntax
<a name="integration-server-sdk-go-processready-syntax"></a>

```
func ProcessReady(param ProcessParameters) error
```

### Parameters
<a name="integration-server-sdk-go-processready-parameter"></a>

**ProcessParameters**  
A [ProcessParameters](integration-server-sdk-go-datatypes.md#integration-server-sdk-go-dataypes-process) object communicates the following information about the server process:  
+ The names of the callback methods implemented in the game server code that the Amazon GameLift Servers service invokes to communicate with the server process.
+ The port number that the server process is listening on.
+ The [LogParameters](integration-server-sdk-go-datatypes.md#integration-server-sdk-go-dataypes-log) data type containing the path to any game session-specific files that you want Amazon GameLift Servers to capture and store.

### Return value
<a name="integration-server-sdk-go-processready-return"></a>

Returns an error with an error message if the method fails. Returns `nil` if the method is successful.

### Example
<a name="integration-server-sdk-go-processready-example"></a>

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

```
// Define the process parameters
processParams := ProcessParameters {
  OnStartGameSession: gameProcess.OnStartGameSession,
  OnUpdateGameSession: gameProcess.OnGameSessionUpdate,
  OnProcessTerminate: gameProcess.OnProcessTerminate,
  OnHealthCheck: gameProcess.OnHealthCheck,
  Port: port,
  LogParameters: LogParameters {    // logging and error example
    []string {"C:\\game\\logs", "C:\\game\\error"}
  }
}

err := server.ProcessReady(processParams)
```

## ProcessEnding()
<a name="integration-server-sdk-go-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-sdk-go-processending-syntax"></a>

```
func ProcessEnding() error
```

### Return value
<a name="integration-server-sdk-go-processending-return"></a>

Returns a 0 error code or a defined error code.

### Example
<a name="integration-server-sdk-go-processending-example"></a>

```
// operations to end game sessions and the server process
defer func() {
  err := server.ProcessEnding()
  server.Destroy()
  if err != nil {
    fmt.Println("ProcessEnding() failed. Error: ", err)
    os.Exit(-1)
  } else {
    os.Exit(0)
  }
}
```

## ActivateGameSession()
<a name="integration-server-sdk-go-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 is called as part of the `onStartGameSession()` callback function, after all game session initialization.

### Syntax
<a name="integration-server-sdk-go-activategamesession-syntax"></a>

```
func ActivateGameSession() error
```

### Return value
<a name="integration-server-sdk-go-activategamesession-return"></a>

Returns an error with an error message if the method fails.

### Example
<a name="integration-server-sdk-go-activategamesession-example"></a>

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

```
func OnStartGameSession(GameSession gameSession) {
  // game-specific tasks when starting a new game session, such as loading map   
  // Activate when ready to receive players   
  err := server.ActivateGameSession();
}
```

## UpdatePlayerSessionCreationPolicy()
<a name="integration-server-sdk-go-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-sdk-go-updateplayersessioncreationpolicy-syntax"></a>

```
func UpdatePlayerSessionCreationPolicy(policy model.PlayerSessionCreationPolicy) error
```

### Parameters
<a name="integration-server-sdk-go-updateplayersessioncreationpolicy-parameter"></a>

**playerSessionCreationPolicy**  
String value that indicates whether the game session accepts new players.   
Valid values include:  
+ **`model.AcceptAll`** – Accept all new player sessions.
+ **`model.DenyAll`** – Deny all new player sessions.

### Return value
<a name="integration-server-sdk-go-updateplayersessioncreationpolicy-return"></a>

Returns an error with an error message if failure occurs.

### Example
<a name="integration-server-sdk-go-updateplayersessioncreationpolicy-example"></a>

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

```
err := server.UpdatePlayerSessionCreationPolicy(model.AcceptAll)
```

## GetGameSessionId()
<a name="integration-server-sdk-go-getgamesessionid"></a>

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

### Syntax
<a name="integration-server-sdk-go-getgamesessionid-syntax"></a>

```
func GetGameSessionID() (string, error)
```

### Parameters
<a name="integration-server-sdk-go-getgamesessionid-parameter"></a>

This action has no parameters.

### Return value
<a name="integration-server-sdk-go-getgamesessionid-return"></a>

If successful, returns the game session ID and nil error. For idle processes that aren't yet activated with a game session, the call returns an empty string and `nil` error.

### Example
<a name="integration-server-sdk-go-getgamesessionid-example"></a>

```
gameSessionID, err := server.GetGameSessionID()
```

## GetTerminationTime()
<a name="integration-server-sdk-go-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 this 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 hasn't 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-sdk-go-getterm-syntax"></a>

```
func GetTerminationTime() (int64, error)
```

### Return value
<a name="integration-server-sdk-go-getterm-return"></a>

If successful, returns the timestamp in epoch seconds that the server process is scheduled to shut down and a `nil` error termination. The value is the termination time, expressed in elapsed ticks from `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.

### Example
<a name="integration-server-sdk-go-getterm-example"></a>

```
terminationTime, err := server.GetTerminationTime()
```

## AcceptPlayerSession()
<a name="integration-server-sdk-go-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-sdk-go-acceptplayersession-syntax"></a>

```
func AcceptPlayerSession(playerSessionID string) error
```

### Parameters
<a name="integration-server-sdk-go-acceptplayersession-parameter"></a>

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

### Return value
<a name="integration-server-sdk-go-acceptplayersession-return"></a>

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

### Example
<a name="integration-server-sdk-go-acceptplayersession-example"></a>

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

```
func ReceiveConnectingPlayerSessionID(conn Connection, playerSessionID string) {
    err := server.AcceptPlayerSession(playerSessionID)
    if err != nil {
        connection.Accept()
    } else {
        connection.Reject(err.Error())
    }
}
```

## RemovePlayerSession()
<a name="integration-server-sdk-go-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-sdk-go-removeplayersession-syntax"></a>

```
func RemovePlayerSession(playerSessionID string) error
```

### Parameters
<a name="integration-server-sdk-go-removeplayersession-parameter"></a>

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

### Return value
<a name="integration-server-sdk-go-removeplayersession-return"></a>

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

### Example
<a name="integration-server-sdk-go-removeplayersession-example"></a>

```
err := server.RemovePlayerSession(playerSessionID)
```

## DescribePlayerSessions()
<a name="integration-server-sdk-go-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-sdk-go-describeplayersessions-syntax"></a>

```
func DescribePlayerSessions(req request.DescribePlayerSessionsRequest) (result.DescribePlayerSessionsResult, error) {
	return srv.describePlayerSessions(&req)
}
```

### Parameters
<a name="integration-server-sdk-go-describeplayersessions-parameter"></a>

**[DescribePlayerSessionsRequest](integration-server-sdk-go-datatypes.md#integration-server-sdk-go-dataypes-playersessions)**  
A `DescribePlayerSessionsRequest` object describes which player sessions to retrieve.

### Return value
<a name="integration-server-sdk-go-describeplayersessions-return"></a>

If successful, returns a `DescribePlayerSessionsResult` object that contains a set of player session objects that fit the request parameters.

### Example
<a name="integration-server-sdk-go-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.

```
// create request
describePlayerSessionsRequest := request.NewDescribePlayerSessions() 
describePlayerSessionsRequest.GameSessionID, _ = server.GetGameSessionID() // get ID for the current game session
describePlayerSessionsRequest.Limit = 10                                 // return the first 10 player sessions
describePlayerSessionsRequest.PlayerSessionStatusFilter = "ACTIVE"         // Get all player sessions actively connected to the game session

describePlayerSessionsResult, err := server.DescribePlayerSessions(describePlayerSessionsRequest)
```

## StartMatchBackfill()
<a name="integration-server-sdk-go-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-sdk-go-stopmatchbackfill) to cancel the original request.

### Syntax
<a name="integration-server-sdk-go-startmatchbackfill-syntax"></a>

```
func StartMatchBackfill(req request.StartMatchBackfillRequest) (result.StartMatchBackfillResult, error)
```

### Parameters
<a name="integration-server-sdk-go-startmatchbackfill-parameter"></a>

**[StartMatchBackfillRequest](integration-server-sdk-go-datatypes.md#integration-server-sdk-go-dataypes-startmatchbackfillrequest)**  
A StartMatchBackfillRequest object 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 generates 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-sdk-go-startmatchbackfill-return"></a>

Returns a `StartMatchBackfillResult` object with the match backfill ticket ID, or failure with an error message. 

### Example
<a name="integration-server-sdk-go-startmatchbackfill-example"></a>

```
// form the request
startBackfillRequest := request.NewStartMatchBackfill()
startBackfillRequest.RequestID = "1111aaaa-22bb-33cc-44dd-5555eeee66ff"          // optional
startBackfillRequest.MatchmakingConfigurationArn = "arn:aws:gamelift:us-west-2:111122223333:matchmakingconfiguration/MyMatchmakerConfig"
var matchMaker model.MatchmakerData
if err := matchMaker.UnmarshalJSON([]byte(gameSession.MatchmakerData)); err != nil {    
    return
}
startBackfillRequest.Players = matchMaker.Players
res, err := server.StartMatchBackfill(startBackfillRequest)

// Implement callback function for backfill
func OnUpdateGameSession(myGameSession model.GameSession) {
    // game-specific tasks to prepare for the newly matched players and update matchmaker data as needed
}
```

## StopMatchBackfill()
<a name="integration-server-sdk-go-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-sdk-go-stopmatchbackfill-syntax"></a>

```
func StopMatchBackfill(req request.StopMatchBackfillRequest) error
```

### Parameters
<a name="integration-server-sdk-go-stopmatchbackfill-parameter"></a>

**[StopMatchBackfillRequest](integration-server-sdk-go-datatypes.md#integration-server-sdk-go-dataypes-stopmatchbackfillrequest)**  
A StopMatchBackfillRequest object that identifies 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-sdk-go-stopmatchbackfill-return"></a>

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

### Example
<a name="integration-server-sdk-go-stopmatchbackfill-example"></a>

```
stopBackfillRequest := request.NewStopMatchBackfill()  // Use this function to create request
stopBackfillRequest.TicketID = "1111aaaa-22bb-33cc-44dd-5555eeee66ff"
stopBackfillRequest.MatchmakingConfigurationArn = "arn:aws:gamelift:us-west-2:111122223333:matchmakingconfiguration/MyMatchmakerConfig"
                
//error
err := server.StopMatchBackfill(stopBackfillRequest)
```

## GetComputeCertificate()
<a name="integration-server-sdk-go-getcomputecertificate"></a>

Retrieves the path to the TLS certificate used to encrypt the network connection between the game server and your game client. 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-sdk-go-getcomputecertificate-syntax"></a>

```
func GetComputeCertificate() (result.GetComputeCertificateResult, error)
```

### Return value
<a name="integration-server-sdk-go-getcomputecertificate-return"></a>

Returns a `GetComputeCertificateResult` object that contains the following: 
+  CertificatePath: The path to the TLS certificate on your compute resource. When using an Amazon GameLift Servers managed fleet, this path contains: 
  + `certificate.pem`: The end-user certificate. The full certificate chain is the combination of `certificateChain.pem` appended to this certificate.
  + `certificateChain.pem`: The certificate chain that contains the root certificate and intermediate certificates.
  + `rootCertificate.pem`: The root certificate.
  + `privateKey.pem`: The private key for the end-user certificate.
+ ComputeName: The name of your compute resource.

### Example
<a name="integration-server-sdk-go-getcomputecertificate-example"></a>

```
tlsCertificate, err := server.GetFleetRoleCredentials(getFleetRoleCredentialsRequest)
```

## GetFleetRoleCredentials()
<a name="integration-server-sdk-go-getfleetrolecredentials"></a>

Retrieves the service role credentials that you create to extend permissions to your other AWS services to Amazon GameLift Servers. These credentials allow your game server to use your AWS resources. For more information, see [Set up an IAM service role for Amazon GameLift Servers](setting-up-role.md).

### Syntax
<a name="integration-server-sdk-go-getfleetrolecredentials-syntax"></a>

```
func GetFleetRoleCredentials(
  req request.GetFleetRoleCredentialsRequest,
) (result.GetFleetRoleCredentialsResult, error) {
  return srv.getFleetRoleCredentials(&req)
}
```

### Parameters
<a name="integration-server-sdk-go-getfleetrolecredentials-parameters"></a>

[GetFleetRoleCredentialsRequest](integration-server-sdk-go-datatypes.md#integration-server-sdk-go-dataypes-getfleetrolecredentialsrequest)  
Role credentials that extend limited access to your AWS resources to the game server.

### Return value
<a name="integration-server-sdk-go-getfleetrolecredentials-return"></a>

Returns a `GetFleetRoleCredentialsResult` object that contains the following: 
+ AssumedRoleUserArn - The Amazon Resource Name (ARN) of the user that the service role belongs to. 
+ AssumedRoleId - The ID of the user that the service role belongs to. 
+ AccessKeyId - The access key ID to authenticate and provide access to your AWS resources. 
+ SecretAccessKey - The secret access key ID for authentication. 
+ SessionToken - A token to identify the current active session interacting with your AWS resources. 
+ Expiration - The amount of time until your session credentials expire.

### Example
<a name="integration-server-sdk-go-getfleetrolecredentials-example"></a>

```
// form the customer credentials request
getFleetRoleCredentialsRequest := request.NewGetFleetRoleCredentials()
getFleetRoleCredentialsRequest.RoleArn = "arn:aws:iam::123456789012:role/service-role/exampleGameLiftAction"

credentials, err := server.GetFleetRoleCredentials(getFleetRoleCredentialsRequest)
```

## Destroy()
<a name="integration-server-sdk-go-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-sdk-go-destroy-syntax"></a>

```
func Destroy() error {
	return srv.destroy()
}
```

### Return value
<a name="integration-server-sdk-go-destroy-return"></a>

Returns an error with an error message if the method fails.

### Example
<a name="integration-server-sdk-go-destroy-example"></a>

```
// operations to end game sessions and the server process
defer func() {
  err := server.ProcessEnding()
  server.Destroy()
  if err != nil {
    fmt.Println("ProcessEnding() failed. Error: ", err)
    os.Exit(-1)
  } else {
    os.Exit(0)
  }
}
```

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

Use the Amazon GameLift Servers Unreal server SDK 5.x reference to help you prepare your multiplayer game for use with Amazon GameLift Servers. For details about the integration process, see [Add Amazon GameLift Servers to your game server with the server SDK](gamelift-sdk-server-api.md). If you're using the Amazon GameLift Servers plugin for Unreal, see also [Amazon GameLift Servers plugin for Unreal Engine](unreal-plugin.md).

**Note**  
This topic describes the Amazon GameLift Servers C\$1\$1 API that you can use when you build for the Unreal Engine. Specifically, this documentation applies to code that you compile with the `-DBUILD_FOR_UNREAL=1` option. 

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

Use the Amazon GameLift Servers Unreal server SDK 5.x reference to help you prepare your multiplayer game for use with Amazon GameLift Servers. For details about the integration process, see [Add Amazon GameLift Servers to your game server with the server SDK](gamelift-sdk-server-api.md). If you're using the Amazon GameLift Servers plugin for Unreal, see also [Amazon GameLift Servers plugin for Unreal Engine](unreal-plugin.md).

**Note**  
This topic describes the Amazon GameLift Servers C\$1\$1 API that you can use when you build for the Unreal Engine. Specifically, this documentation applies to code that you compile with the `-DBUILD_FOR_UNREAL=1` option. 

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

**Topics**
+ [FProcessParameters](#integration-server-sdk5-unreal-dataypes-process)
+ [UpdateGameSession](#integration-server-sdk5-unreal-dataypes-updategamesession)
+ [GameSession](#integration-server-sdk5-unreal-dataypes-gamesession)
+ [FServerParameters](#integration-server-sdk5-unreal-dataypes-serverparameters)
+ [FStartMatchBackfillRequest](#integration-server-sdk5-unreal-dataypes-startmatchbackfillrequest)
+ [FPlayer](#integration-server-sdk5-unreal-dataypes-player)
+ [FGameLiftDescribePlayerSessionsRequest](#integration-server-sdk5-unreal-dataypes-playersessions)
+ [FStopMatchBackfillRequest](#integration-server-sdk5-unreal-dataypes-stopmatchbackfillrequest)
+ [FAttributeValue](#integration-server-sdk5-unreal-dataypes-attributevalue)
+ [FGameLiftGetFleetRoleCredentialsRequest](#integration-server-sdk5-unreal-dataypes-getfleetrolecredentialsrequest)
+ [FGameLiftLongOutcome](#integration-server-sdk5-unreal-dataypes-awslongoutcome)
+ [FGameLiftStringOutcome](#integration-server-sdk5-unreal-dataypes-awsstringoutcome)
+ [FGameLiftDescribePlayerSessionsOutcome](#integration-server-sdk5-unreal-dataypes-describeplayersessionsoutcome)
+ [FGameLiftDescribePlayerSessionsResult](#integration-server-sdk5-unreal-dataypes-describeplayersessionresult)
+ [FGenericOutcome](#integration-server-sdk5-unreal-dataypes-genericoutcome)
+ [FGameLiftPlayerSession](#integration-server-sdk5-unreal-dataypes-playersession)
+ [FGameLiftGetComputeCertificateOutcome](#integration-server-sdk5-unreal-dataypes-getcomputecertificateoutcome)
+ [FGameLiftGetComputeCertificateResult](#integration-server-sdk5-unreal-dataypes-getcomputecertificateresult)
+ [FGameLiftGetFleetRoleCredentialsOutcome](#integration-server-sdk5-unreal-dataypes-getfleetrolecredentialsoutcome)
+ [FGetFleetRoleCredentialsResult](#integration-server-sdk5-unreal-dataypes-getfleetrolecredentialsresult)
+ [FGameLiftError](#integration-server-sdk5-unreal-dataypes-gamelifterror)
+ [Enums](#integration-server-sdk5-unreal-dataypes-enums)

## FProcessParameters
<a name="integration-server-sdk5-unreal-dataypes-process"></a>

This data type contains the set of parameters sent to Amazon GameLift Servers in a [ProcessReady()](integration-server-sdk5-unreal-actions.md#integration-server-sdk5-unreal-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:** `TArray<FString>`**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. This property is a delegate function defined as `DECLARE_DELEGATE_RetVal(bool, FOnHealthCheck)`;   **Type:** `FOnHealthCheck`**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-unreal-actions.md#integration-server-sdk5-unreal-processending) call before it shuts down the server process.**Type:** `FSimpleDelegate`**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-unreal-dataypes-gamesession) object. This property is a delegate function defined as `DECLARE_DELEGATE_OneParam(FOnStartGameSession, Aws::GameLift::Server::Model::GameSession);`  **Type:** `FOnStartGameSession`**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-unreal-dataypes-gamesession) object, a status update (updateReason), and the match backfill ticket ID. This property is a delegate function defined as `DECLARE_DELEGATE_OneParam(FOnUpdateGameSession, Aws::GameLift::Server::Model::UpdateGameSession);` **Type:** `FOnUpdateGameSession`**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:** `int`**Required:** Yes | 

## UpdateGameSession
<a name="integration-server-sdk5-unreal-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-unreal-dataypes-gamesession) object. The GameSession object contains properties describing a game session. **Type:** `Aws::GameLift::Server::GameSession`**Required:** No | 
| UpdateReason | The reason that the game session is being updated. **Type:** `enum class UpdateReason`  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/gameliftservers/latest/developerguide/integration-server-sdk5-unreal-datatypes.html) **Required:** No   | 
| BackfillTicketId | The ID of the backfill ticket attempting to update the game session.**Type:** `char[]`**Required:** No | 

## GameSession
<a name="integration-server-sdk5-unreal-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:** `char[]` **Required**: No  | 
| Name |  A descriptive label of the game session.  **Type:** `char[]` **Required**: No  | 
| FleetId |  A unique identifier for the fleet that the game session is running on. **Type:** `char[]` **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:** `int` **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:** `char[]` **Required**: No  | 
| GameSessionData |  A set of custom game session properties, formatted as a single string value.  **Type:** `char[]` **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:** `char[]` **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:** `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-unreal-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:** `char[]` **Required**: No  | 

## FServerParameters
<a name="integration-server-sdk5-unreal-dataypes-serverparameters"></a>

Information used to maintain the connection between an Amazon GameLift Servers Anywhere server and the Amazon GameLift Servers service. This information is used when launching new server processes with [InitSDK()](integration-server-sdk5-unreal-actions.md#integration-server-sdk5-unreal-initsdk). For servers hosted on Amazon GameLift Servers managed EC2 instances, use an empty object.


| 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:** `char[]` **Required**: Yes   | 
| processId |  A unique identifier registered to the server process hosting your game. **Type:** `char[]` **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:** `char[]`**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:** `char[]`**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:** `char[]`**Required**: Yes | 

## FStartMatchBackfillRequest
<a name="integration-server-sdk5-unreal-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-unreal-actions.md#integration-server-sdk5-unreal-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-unreal-actions.html#integration-server-sdk5-unreal-getgamesessionid)` returns the identifier in ARN format. **Type:** `char[]` **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:** `char[]` **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:** `TArray<FPlayer>` **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:** `char[]` **Required**: No  | 

## FPlayer
<a name="integration-server-sdk5-unreal-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:** `TMap>FString, int32<` **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:** `TMap>FString, FAttributeValue<` **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:** `FString` **Required**: No  | 

## FGameLiftDescribePlayerSessionsRequest
<a name="integration-server-sdk5-unreal-dataypes-playersessions"></a>

An object that specifies which player sessions to retrieve. The server process provides this information with a [DescribePlayerSessions()](integration-server-sdk5-unreal-actions.md#integration-server-sdk5-unreal-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 `FString`. 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:** `FString` **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:** `FString` **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-unreal-datatypes.html) **Type:** `FString` **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:** `FString` **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  | 

## FStopMatchBackfillRequest
<a name="integration-server-sdk5-unreal-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-unreal-actions.md#integration-server-sdk5-unreal-stopmatchbackfill) call.


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

## FAttributeValue
<a name="integration-server-sdk5-unreal-dataypes-attributevalue"></a>

Use these values in [FPlayer](#integration-server-sdk5-unreal-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 can use only one of the available properties.


| Properties | Description | 
| --- | --- | 
| attrType |  Specifies the type of attribute value. **Type:** An `FAttributeType` [enum](#integration-server-sdk5-unreal-dataypes-enums) value.  **Required:** No  | 
| S |  Represents a string attribute value. **Type:** `FString` **Required:** No  | 
| N |  Represents a numeric attribute value. **Type:** `double` **Required:** No  | 
| SL |  Represents an array of string attribute values. **Type:** `TArray<FString>` **Required:** No  | 
| SDM |  Represents a dictionary of string keys and double values. **Type:** `TMap<FString, double>` **Required:** No  | 

## FGameLiftGetFleetRoleCredentialsRequest
<a name="integration-server-sdk5-unreal-dataypes-getfleetrolecredentialsrequest"></a>

This data type provides role credentials that extend limited access to your AWS resources to the game server. 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:** `FString`**Required**: No | 
| RoleSessionName | The name of the session describing the use of the role credentials.**Type:** `FString`**Required**: No | 

## FGameLiftLongOutcome
<a name="integration-server-sdk5-unreal-dataypes-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:** [FGameLiftError](#integration-server-sdk5-unreal-dataypes-gamelifterror) **Required:** No  | 

## FGameLiftStringOutcome
<a name="integration-server-sdk5-unreal-dataypes-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:** `FString` **Required:** No  | 
| ResultWithOwnership |   The result of the action, cast as an rvalue, so that the calling code can take ownership of the object.  **Type:** `FString&&` **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:** [FGameLiftError](#integration-server-sdk5-unreal-dataypes-gamelifterror) **Required:** No  | 

## FGameLiftDescribePlayerSessionsOutcome
<a name="integration-server-sdk5-unreal-dataypes-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:** [FGameLiftDescribePlayerSessionsResult](#integration-server-sdk5-unreal-dataypes-describeplayersessionresult) **Required:** No   | 
| ResultWithOwnership |   The result of the action, cast as an rvalue, so that the calling code can take ownership of the object.  **Type:** `FGameLiftDescribePlayerSessionsResult&&` **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:** [FGameLiftError](#integration-server-sdk5-unreal-dataypes-gamelifterror) **Required:** No  | 

## FGameLiftDescribePlayerSessionsResult
<a name="integration-server-sdk5-unreal-dataypes-describeplayersessionresult"></a>


| Properties | Description | 
| --- | --- | 
| PlayerSessions |   **Type:** `TArray<FGameLiftPlayerSession>` **Required:** Yes  | 
| 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:** `FString` **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:** [FGameLiftError](#integration-server-sdk5-unreal-dataypes-gamelifterror) **Required:** No  | 

## FGenericOutcome
<a name="integration-server-sdk5-unreal-dataypes-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:** [FGameLiftError](#integration-server-sdk5-unreal-dataypes-gamelifterror) **Required:** No  | 

## FGameLiftPlayerSession
<a name="integration-server-sdk5-unreal-dataypes-playersession"></a>


| Properties | Description | 
| --- | --- | 
| CreationTime |  **Type:** `long` **Required:** Yes  | 
| FleetId |  **Type:** `FString` **Required:** Yes  | 
| GameSessionId |  **Type:** `FString` **Required:** Yes  | 
| IpAddress |  **Type:** `FString` **Required:** Yes  | 
| PlayerData |  **Type:** `FString` **Required:** Yes  | 
| PlayerId |  **Type:** `FString` **Required:** Yes  | 
| PlayerSessionId |  **Type:** `FString` **Required:** Yes  | 
| Port |  **Type:** `int` **Required:** Yes  | 
| Status |  **Type:** A `PlayerSessionStatus` [enum](integration-server-sdk5-cpp-datatypes.md#integration-server-sdk5-cpp-dataypes-enums). **Required:** Yes  | 
| TerminationTime |  **Type:** `long` **Required:** Yes  | 
| DnsName |  **Type:** `FString` **Required:** Yes  | 

## FGameLiftGetComputeCertificateOutcome
<a name="integration-server-sdk5-unreal-dataypes-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:** [FGameLiftGetComputeCertificateResult](#integration-server-sdk5-unreal-dataypes-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:** `FGameLiftGetComputeCertificateResult&&` **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:** [FGameLiftError](#integration-server-sdk5-unreal-dataypes-gamelifterror) **Required:** No  | 

## FGameLiftGetComputeCertificateResult
<a name="integration-server-sdk5-unreal-dataypes-getcomputecertificateresult"></a>

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


| Properties | Description | 
| --- | --- | 
| CertificatePath |  **Type:** `FString` **Required:** Yes  | 
| ComputeName |  **Type:** `FString` **Required:** Yes  | 

## FGameLiftGetFleetRoleCredentialsOutcome
<a name="integration-server-sdk5-unreal-dataypes-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:** [FGetFleetRoleCredentialsResult](#integration-server-sdk5-unreal-dataypes-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:** `FGameLiftGetFleetRoleCredentialsResult&&` **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:** [FGameLiftError](#integration-server-sdk5-unreal-dataypes-gamelifterror) **Required:** No  | 

## FGetFleetRoleCredentialsResult
<a name="integration-server-sdk5-unreal-dataypes-getfleetrolecredentialsresult"></a>


| Properties | Description | 
| --- | --- | 
| AccessKeyId |  The access key ID to authenticate and provide access to your AWS resources. **Type:** `FString` **Required:** No  | 
| AssumedRoleId |  The ID of the user that the service role belongs to. **Type:** `FString` **Required:** No  | 
| AssumedRoleUserArn |  The Amazon Resource Name (ARN) of the user that the service role belongs to. **Type:** `FString` **Required:** No  | 
| Expiration |  The amount of time until your session credentials expire. **Type:** `FDateTime` **Required:** No  | 
| SecretAccessKey |  The secret access key ID for authentication. **Type:** `FString` **Required:** No  | 
| SessionToken |  A token to identify the current active session interacting with your AWS resources. **Type:** `FString` **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  | 

## FGameLiftError
<a name="integration-server-sdk5-unreal-dataypes-gamelifterror"></a>


| Properties | Description | 
| --- | --- | 
| ErrorType |  The type of error. **Type:** A `GameLiftErrorType` [enum](integration-server-sdk5-cpp-datatypes.md#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-unreal-dataypes-enums"></a>

Enums defined for the server SDK for Amazon GameLift Servers (Unreal) are defined as follows:

**FAttributeType**  
+ **NONE**
+ **STRING**
+ **DOUBLE**
+ **STRING\$1LIST**
+ **STRING\$1DOUBLE\$1MAP**

**GameLiftErrorType**  
String value indicating the error type. Valid values include:  
+ **SERVICE\$1CALL\$1FAILED** – A call to an AWS service has failed. 
+ **LOCAL\$1CONNECTION\$1FAILED** – The local connection to Amazon GameLift Servers failed. 
+ **NETWORK\$1NOT\$1INITIALIZED** – The network has not been initialized. 
+ **GAMESESSION\$1ID\$1NOT\$1SET** – The game session ID has not been set. 
+ **BAD\$1REQUEST\$1EXCEPTION** 
+ **INTERNAL\$1SERVICE\$1EXCEPTION** 
+ **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. 

**EPlayerSessionCreationPolicy**  
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. 

**EPlayerSessionStatus**  
+ **ACTIVE**
+ **COMPLETED**
+ **NOT\$1SET**
+ **RESERVED**
+ **TIMEDOUT**

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

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

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

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

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

```
FGameLiftStringOutcome GetSdkVersion();
```

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

If successful, returns the current SDK version as an [FGameLiftStringOutcome](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-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-unreal-getsdkversion-example"></a>

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

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

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

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

```
FGameLiftGenericOutcome InitSDK()
```

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

If successful, returns an `InitSdkOutcome` object indicating that the server process is ready to call [ProcessReady()](#integration-server-sdk5-unreal-processready). 

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

```
//Call InitSDK to establish a local connection with the Amazon GameLift Servers Agent to enable further communication.
FGameLiftGenericOutcome initSdkOutcome = GameLiftSdkModule->InitSDK();
```

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

Initializes the Amazon GameLift Servers SDK for an Anywhere fleet or managed container fleet. Call this method on launch, before any other initialization related to Amazon GameLift Servers occurs. This method requires explicit server parameters to set up communication between the server and the Amazon GameLift Servers service. It uses an idempotency token, so you safely retry this call when it fails.

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

```
FGameLiftGenericOutcome InitSDK(serverParameters)
```

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

[FServerParameters](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-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-unreal-initsdk-anywhere-return"></a>

If successful, returns an `InitSdkOutcome` object indicating that the server process is ready to call [ProcessReady()](#integration-server-sdk5-unreal-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-unreal-initsdk-anywhere-example"></a>

```
//Define the server parameters
FServerParameters serverParameters;
parameters.m_authToken = "1111aaaa-22bb-33cc-44dd-5555eeee66ff"; 
parameters.m_fleetId = "arn:aws:gamelift:us-west-1:111122223333:fleet/fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa";
parameters.m_hostId = "HardwareAnywhere"; 
parameters.m_processId = "PID1234";
parameters.m_webSocketUrl = "wss://us-west-1.api.amazongamelift.com"; 

//Call InitSDK to establish a local connection with the Amazon GameLift Servers Agent to enable further communication.
FGameLiftGenericOutcome initSdkOutcome = GameLiftSdkModule->InitSDK(serverParameters);
```

## ProcessReady()
<a name="integration-server-sdk5-unreal-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-unreal-initsdk). This method should be called only once per process.

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

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

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

**processParameters**  
An [FProcessParameters](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-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-unreal-processready-return"></a>

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

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

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

```
//Calling ProcessReady tells Amazon GameLift Servers this game server is ready to receive incoming game sessions!
UE_LOG(GameServerLog, Log, TEXT("Calling Process Ready"));
FGameLiftGenericOutcome processReadyOutcome = GameLiftSdkModule->ProcessReady(*params);
```

## ProcessEnding()
<a name="integration-server-sdk5-unreal-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-unreal-processending-syntax"></a>

```
FGameLiftGenericOutcome ProcessEnding()
```

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

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

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

```
//OnProcessTerminate callback. Amazon GameLift Servers will invoke this callback before shutting down an instance hosting this game server.
//It gives this game server a chance to save its state, communicate with services, etc., before being shut down.
//In this case, we simply tell Amazon GameLift Servers we are indeed going to shutdown.
params->OnTerminate.BindLambda([=]() {
  UE_LOG(GameServerLog, Log, TEXT("Game Server Process is terminating"));
  GameLiftSdkModule->ProcessEnding();
});
```

## ActivateGameSession()
<a name="integration-server-sdk5-unreal-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-unreal-activategamesession-syntax"></a>

```
FGameLiftGenericOutcome ActivateGameSession()
```

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

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

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

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

```
//When a game session is created, Amazon GameLift Servers sends an activation request to the game server and passes along the game session object containing game properties and other settings.
//Here is where a game server should take action based on the game session object.
//Once the game server is ready to receive incoming player connections, it should invoke GameLiftServerAPI.ActivateGameSession()
auto onGameSession = [=](Aws::GameLift::Server::Model::GameSession gameSession)
{
  FString gameSessionId = FString(gameSession.GetGameSessionId());
  UE_LOG(GameServerLog, Log, TEXT("GameSession Initializing: %s"), *gameSessionId);
  GameLiftSdkModule->ActivateGameSession();
};
```

## UpdatePlayerSessionCreationPolicy()
<a name="integration-server-sdk5-unreal-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-unreal-updateplayersessioncreationpolicy-syntax"></a>

```
FGameLiftGenericOutcome UpdatePlayerSessionCreationPolicy(EPlayerSessionCreationPolicy policy)
```

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

**playerCreationSessionPolicy**  
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.

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

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

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

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

```
FGameLiftGenericOutcome outcome = GameLiftSdkModule->UpdatePlayerSessionCreationPolicy(Aws::GameLift::Model::EPlayerSessionCreationPolicy::ACCEPT_ALL);
```

## GetGameSessionId()
<a name="integration-server-sdk5-unreal-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 [FGameLiftError](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-gamelifterror).

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

```
FGameLiftStringOutcome GetGameSessionId()
```

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

This action has no parameters.

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

If successful, returns the game session ID as an [FGameLiftStringOutcome](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-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-unreal-getgamesessionid-example"></a>

```
//When a game session is created, Amazon GameLift Servers sends an activation request to the game server and passes along the game session object containing game properties and other settings.
//Here is where a game server should take action based on the game session object.
//Once the game server is ready to receive incoming player connections, it should invoke GameLiftServerAPI.ActivateGameSession()
auto onGameSession = [=](Aws::GameLift::Server::Model::GameSession gameSession)
{
  FString gameSessionId = FString(gameSession.GetGameSessionId());
  UE_LOG(GameServerLog, Log, TEXT("GameSession Initializing: %s"), *gameSessionId);
  GameLiftSdkModule->ActivateGameSession();
};
```

## GetTerminationTime()
<a name="integration-server-sdk5-unreal-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-unreal-getterm-syntax"></a>

```
AwsDateTimeOutcome GetTerminationTime()
```

### Return value
<a name="integration-server-sdk5-unreal-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-unreal-getterm-example"></a>

```
AwsDateTimeOutcome TermTimeOutcome = GameLiftSdkModule->GetTerminationTime();
```

## AcceptPlayerSession()
<a name="integration-server-sdk5-unreal-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-unreal-acceptplayersession-syntax"></a>

```
FGameLiftGenericOutcome AcceptPlayerSession(const FString& playerSessionId)
```

### Parameters
<a name="integration-server-sdk5-unreal-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-unreal-acceptplayersession-return"></a>

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

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

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

```
bool GameLiftManager::AcceptPlayerSession(const FString& playerSessionId, const FString& playerId)
{
  #if WITH_GAMELIFT
  UE_LOG(GameServerLog, Log, TEXT("Accepting GameLift PlayerSession: %s . PlayerId: %s"), *playerSessionId, *playerId);
  FString gsId = GetCurrentGameSessionId();
  if (gsId.IsEmpty()) {
    UE_LOG(GameServerLog, Log, TEXT("No GameLift GameSessionId. Returning early!"));
    return false;
  }
  
  if (!GameLiftSdkModule->AcceptPlayerSession(playerSessionId).IsSuccess()) {
    UE_LOG(GameServerLog, Log, TEXT("PlayerSession not Accepted."));
    return false;
  }

  // Add PlayerSession from internal data structures keeping track of connected players
  connectedPlayerSessionIds.Add(playerSessionId);
  idToPlayerSessionMap.Add(playerSessionId, PlayerSession{ playerId, playerSessionId });
  return true;
  #else
  return false;
  #endif
}
```

## RemovePlayerSession()
<a name="integration-server-sdk5-unreal-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-unreal-removeplayersession-syntax"></a>

```
FGameLiftGenericOutcome RemovePlayerSession(const FString& playerSessionId)
```

### Parameters
<a name="integration-server-sdk5-unreal-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-unreal-removeplayersession-return"></a>

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

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

```
bool GameLiftManager::RemovePlayerSession(const FString& playerSessionId)
{
  #if WITH_GAMELIFT
  UE_LOG(GameServerLog, Log, TEXT("Removing GameLift PlayerSession: %s"), *playerSessionId);

  if (!GameLiftSdkModule->RemovePlayerSession(playerSessionId).IsSuccess()) {
    UE_LOG(GameServerLog, Log, TEXT("PlayerSession Removal Failed"));
    return false;
  }

  // Remove PlayerSession from internal data structures that are keeping track of connected players
  connectedPlayerSessionIds.Remove(playerSessionId);
  idToPlayerSessionMap.Remove(playerSessionId);

  // end the session if there are no more players connected
  if (connectedPlayerSessionIds.Num() == 0) {
    EndSession();
  }

  return true;
  #else
  return false;
  #endif
}
```

## DescribePlayerSessions()
<a name="integration-server-sdk5-unreal-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-unreal-describeplayersessions-syntax"></a>

```
FGameLiftDescribePlayerSessionsOutcome DescribePlayerSessions(const FGameLiftDescribePlayerSessionsRequest &describePlayerSessionsRequest)
```

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

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

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

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

### Example
<a name="integration-server-sdk5-unreal-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.

```
void GameLiftManager::DescribePlayerSessions()
{
  #if WITH_GAMELIFT
  FString localPlayerSessions;
  for (auto& psId : connectedPlayerSessionIds)
  {
    PlayerSession ps = idToPlayerSessionMap[psId];
    localPlayerSessions += FString::Printf(TEXT("%s : %s  ; "), *(ps.playerSessionId), *(ps.playerId));
  }
  UE_LOG(GameServerLog, Log, TEXT("LocalPlayerSessions: %s"), *localPlayerSessions);

  UE_LOG(GameServerLog, Log, TEXT("Describing PlayerSessions in this GameSession"));
  FGameLiftDescribePlayerSessionsRequest request;
  request.m_gameSessionId = GetCurrentGameSessionId();

  FGameLiftDescribePlayerSessionsOutcome outcome = GameLiftSdkModule->DescribePlayerSessions(request);
  LogDescribePlayerSessionsOutcome(outcome);
  #endif
}
```

## StartMatchBackfill()
<a name="integration-server-sdk5-unreal-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-unreal-stopmatchbackfill) to cancel the original request.

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

```
FGameLiftStringOutcome StartMatchBackfill (FStartMatchBackfillRequest &startBackfillRequest);
```

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

**[FStartMatchBackfillRequest](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-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-unreal-startmatchbackfill-return"></a>

Returns a `StartMatchBackfillOutcome` object with the match backfill ticket ID, or failure with an error message. 

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

```
FGameLiftStringOutcome FGameLiftServerSDKModule::StartMatchBackfill(const FStartMatchBackfillRequest& request) 
{
  #if WITH_GAMELIFT
  Aws::GameLift::Server::Model::StartMatchBackfillRequest sdkRequest;
  sdkRequest.SetTicketId(TCHAR_TO_UTF8(*request.m_ticketId));
  sdkRequest.SetGameSessionArn(TCHAR_TO_UTF8(*request.m_gameSessionArn));
  sdkRequest.SetMatchmakingConfigurationArn(TCHAR_TO_UTF8(*request.m_matchmakingConfigurationArn));
  for (auto player : request.m_players) {
    Aws::GameLift::Server::Model::Player sdkPlayer;
    sdkPlayer.SetPlayerId(TCHAR_TO_UTF8(*player.m_playerId));
    sdkPlayer.SetTeam(TCHAR_TO_UTF8(*player.m_team));
    for (auto entry : player.m_latencyInMs) {
      sdkPlayer.WithLatencyMs(TCHAR_TO_UTF8(*entry.Key), entry.Value);
    }

    std::map<std::string, Aws::GameLift::Server::Model::AttributeValue> sdkAttributeMap;
    for (auto attributeEntry : player.m_playerAttributes) {
      FAttributeValue value = attributeEntry.Value;
      Aws::GameLift::Server::Model::AttributeValue attribute;
      switch (value.m_type) {
        case FAttributeType::STRING:
          attribute = Aws::GameLift::Server::Model::AttributeValue(TCHAR_TO_UTF8(*value.m_S));
        break;
        case FAttributeType::DOUBLE:
          attribute = Aws::GameLift::Server::Model::AttributeValue(value.m_N);
        break;
        case FAttributeType::STRING_LIST:
          attribute = Aws::GameLift::Server::Model::AttributeValue::ConstructStringList();
          for (auto sl : value.m_SL) {
            attribute.AddString(TCHAR_TO_UTF8(*sl));
          };
        break;
        case FAttributeType::STRING_DOUBLE_MAP:
          attribute = Aws::GameLift::Server::Model::AttributeValue::ConstructStringDoubleMap();
          for (auto sdm : value.m_SDM) {
            attribute.AddStringAndDouble(TCHAR_TO_UTF8(*sdm.Key), sdm.Value);
          };
        break;
      }
      sdkPlayer.WithPlayerAttribute((TCHAR_TO_UTF8(*attributeEntry.Key)), attribute);
    }
    sdkRequest.AddPlayer(sdkPlayer);
  }
  auto outcome = Aws::GameLift::Server::StartMatchBackfill(sdkRequest);
  if (outcome.IsSuccess()) {
    return FGameLiftStringOutcome(outcome.GetResult().GetTicketId());
  }
  else {
    return FGameLiftStringOutcome(FGameLiftError(outcome.GetError()));
  }
  #else
  return FGameLiftStringOutcome("");
  #endif
}
```

## StopMatchBackfill()
<a name="integration-server-sdk5-unreal-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-unreal-stopmatchbackfill-syntax"></a>

```
FGameLiftGenericOutcome StopMatchBackfill (FStopMatchBackfillRequest &stopBackfillRequest);
```

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

**[FStopMatchBackfillRequest](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-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-unreal-stopmatchbackfill-return"></a>

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

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

```
FGameLiftGenericOutcome FGameLiftServerSDKModule::StopMatchBackfill(const FStopMatchBackfillRequest& request)
{
  #if WITH_GAMELIFT
  Aws::GameLift::Server::Model::StopMatchBackfillRequest sdkRequest;
  sdkRequest.SetTicketId(TCHAR_TO_UTF8(*request.m_ticketId));
  sdkRequest.SetGameSessionArn(TCHAR_TO_UTF8(*request.m_gameSessionArn));
  sdkRequest.SetMatchmakingConfigurationArn(TCHAR_TO_UTF8(*request.m_matchmakingConfigurationArn));
  auto outcome = Aws::GameLift::Server::StopMatchBackfill(sdkRequest);
  if (outcome.IsSuccess()) {
    return FGameLiftGenericOutcome(nullptr);
  }
  else {
    return FGameLiftGenericOutcome(FGameLiftError(outcome.GetError()));
  }
  #else
  return FGameLiftGenericOutcome(nullptr);
  #endif
}
```

## GetComputeCertificate()
<a name="integration-server-sdk5-unreal-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-unreal-getcomputecertificate-syntax"></a>

```
FGameLiftGetComputeCertificateOutcome FGameLiftServerSDKModule::GetComputeCertificate()
```

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

Returns a `GetComputeCertificateResponse` object containing the following: 
+ CertificatePath: The path to the TLS certificate on your compute resource. 
+ HostName: The host name of your compute resource.

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

```
FGameLiftGetComputeCertificateOutcome FGameLiftServerSDKModule::GetComputeCertificate()
{
  #if WITH_GAMELIFT
  auto outcome = Aws::GameLift::Server::GetComputeCertificate();
  if (outcome.IsSuccess()) {
    auto& outres = outcome.GetResult();
    FGameLiftGetComputeCertificateResult result;
    result.m_certificate_path = UTF8_TO_TCHAR(outres.GetCertificatePath());
    result.m_computeName = UTF8_TO_TCHAR(outres.GetComputeName());
    return FGameLiftGetComputeCertificateOutcome(result);
  }
  else {
    return FGameLiftGetComputeCertificateOutcome(FGameLiftError(outcome.GetError()));
  }
  #else
  return FGameLiftGetComputeCertificateOutcome(FGameLiftGetComputeCertificateResult());
  #endif
}
```

## GetFleetRoleCredentials()
<a name="integration-server-sdk5-unreal-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-unreal-getfleetrolecredentials-syntax"></a>

```
FGameLiftGetFleetRoleCredentialsOutcome FGameLiftServerSDKModule::GetFleetRoleCredentials(const FGameLiftGetFleetRoleCredentialsRequest &request)
```

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

[FGameLiftGetFleetRoleCredentialsRequest](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-getfleetrolecredentialsrequest)

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

Returns a [FGameLiftGetFleetRoleCredentialsOutcome](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-getfleetrolecredentialsoutcome) object.

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

```
FGameLiftGetFleetRoleCredentialsOutcome FGameLiftServerSDKModule::GetFleetRoleCredentials(const FGameLiftGetFleetRoleCredentialsRequest &request)
{
  #if WITH_GAMELIFT
  Aws::GameLift::Server::Model::GetFleetRoleCredentialsRequest sdkRequest;
  sdkRequest.SetRoleArn(TCHAR_TO_UTF8(*request.m_roleArn));
  sdkRequest.SetRoleSessionName(TCHAR_TO_UTF8(*request.m_roleSessionName));

  auto outcome = Aws::GameLift::Server::GetFleetRoleCredentials(sdkRequest);

  if (outcome.IsSuccess()) {
    auto& outres = outcome.GetResult();
    FGameLiftGetFleetRoleCredentialsResult result;
    result.m_assumedUserRoleArn = UTF8_TO_TCHAR(outres.GetAssumedUserRoleArn());
    result.m_assumedRoleId = UTF8_TO_TCHAR(outres.GetAssumedRoleId());
    result.m_accessKeyId = UTF8_TO_TCHAR(outres.GetAccessKeyId());
    result.m_secretAccessKey = UTF8_TO_TCHAR(outres.GetSecretAccessKey());
    result.m_sessionToken = UTF8_TO_TCHAR(outres.GetSessionToken());
    result.m_expiration = FDateTime::FromUnixTimestamp(outres.GetExpiration());
    return FGameLiftGetFleetRoleCredentialsOutcome(result);
  }
  else {
    return FGameLiftGetFleetRoleCredentialsOutcome(FGameLiftError(outcome.GetError()));
  }
  #else
  return FGameLiftGetFleetRoleCredentialsOutcome(FGameLiftGetFleetRoleCredentialsResult());
  #endif
}
```

## Destroy()
<a name="integration-server-sdk5-unreal-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-unreal-ref-destroy-syntax"></a>

```
FGameLiftGenericOutcome Destroy();
```

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

There are no parameters.

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

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

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

```
// First call ProcessEnding()
FGameLiftGenericOutcome processEndingOutcome = GameLiftSdkModule->ProcessEnding();
  
// Then call Destroy() to free the SDK from memory
FGameLiftGenericOutcome destroyOutcome = GameLiftSdkModule->Destroy();
  
// Exit the process with success or failure
if (processEndingOutcome.IsSuccess() && destroyOutcome.IsSuccess()) 
    {
    UE_LOG(GameServerLog, Log, TEXT("Server process ending successfully"));
}
else {
    if (!processEndingOutcome.IsSuccess()) {
        const FGameLiftError& error = processEndingOutcome.GetError();
        UE_LOG(GameServerLog, Error, TEXT("ProcessEnding() failed. Error: %s"),
        error.m_errorMessage.IsEmpty() ? TEXT("Unknown error") : *error.m_errorMessage);
    }
    if (!destroyOutcome.IsSuccess()) {
        const FGameLiftError& error = destroyOutcome.GetError();
        UE_LOG(GameServerLog, Error, TEXT("Destroy() failed. Error: %s"),
        error.m_errorMessage.IsEmpty() ? TEXT("Unknown error") : *error.m_errorMessage);
    }
}
```