1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package gamelift
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/gamelift/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// This operation is used with the GameLift FleetIQ solution and game server
15// groups. Updates information about a registered game server to help GameLift
16// FleetIQ to track game server availability. This operation is called by a game
17// server process that is running on an instance in a game server group. Use this
18// operation to update the following types of game server information. You can make
19// all three types of updates in the same request:
20//
21// * To update the game server's
22// utilization status, identify the game server and game server group and specify
23// the current utilization status. Use this status to identify when game servers
24// are currently hosting games and when they are available to be claimed.
25//
26// * To
27// report health status, identify the game server and game server group and set
28// health check to HEALTHY. If a game server does not report health status for a
29// certain length of time, the game server is no longer considered healthy. As a
30// result, it will be eventually deregistered from the game server group to avoid
31// affecting utilization metrics. The best practice is to report health every 60
32// seconds.
33//
34// * To change game server metadata, provide updated game server
35// data.
36//
37// Once a game server is successfully updated, the relevant statuses and
38// timestamps are updated. Learn more GameLift FleetIQ Guide
39// (https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-intro.html)
40// Related actions RegisterGameServer | ListGameServers | ClaimGameServer |
41// DescribeGameServer | UpdateGameServer | DeregisterGameServer | All APIs by task
42// (https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/reference-awssdk-fleetiq.html)
43func (c *Client) UpdateGameServer(ctx context.Context, params *UpdateGameServerInput, optFns ...func(*Options)) (*UpdateGameServerOutput, error) {
44	if params == nil {
45		params = &UpdateGameServerInput{}
46	}
47
48	result, metadata, err := c.invokeOperation(ctx, "UpdateGameServer", params, optFns, addOperationUpdateGameServerMiddlewares)
49	if err != nil {
50		return nil, err
51	}
52
53	out := result.(*UpdateGameServerOutput)
54	out.ResultMetadata = metadata
55	return out, nil
56}
57
58type UpdateGameServerInput struct {
59
60	// A unique identifier for the game server group where the game server is running.
61	// Use either the GameServerGroup name or ARN value.
62	//
63	// This member is required.
64	GameServerGroupName *string
65
66	// A custom string that uniquely identifies the game server to update.
67	//
68	// This member is required.
69	GameServerId *string
70
71	// A set of custom game server properties, formatted as a single string value. This
72	// data is passed to a game client or service when it requests information on game
73	// servers using ListGameServers or ClaimGameServer.
74	GameServerData *string
75
76	// Indicates health status of the game server. A request that includes this
77	// parameter updates the game server's LastHealthCheckTime timestamp.
78	HealthCheck types.GameServerHealthCheck
79
80	// Indicates whether the game server is available or is currently hosting gameplay.
81	UtilizationStatus types.GameServerUtilizationStatus
82}
83
84type UpdateGameServerOutput struct {
85
86	// Object that describes the newly updated game server.
87	GameServer *types.GameServer
88
89	// Metadata pertaining to the operation's result.
90	ResultMetadata middleware.Metadata
91}
92
93func addOperationUpdateGameServerMiddlewares(stack *middleware.Stack, options Options) (err error) {
94	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateGameServer{}, middleware.After)
95	if err != nil {
96		return err
97	}
98	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateGameServer{}, middleware.After)
99	if err != nil {
100		return err
101	}
102	if err = addSetLoggerMiddleware(stack, options); err != nil {
103		return err
104	}
105	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
106		return err
107	}
108	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
109		return err
110	}
111	if err = addResolveEndpointMiddleware(stack, options); err != nil {
112		return err
113	}
114	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
115		return err
116	}
117	if err = addRetryMiddlewares(stack, options); err != nil {
118		return err
119	}
120	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
121		return err
122	}
123	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
124		return err
125	}
126	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
127		return err
128	}
129	if err = addClientUserAgent(stack); err != nil {
130		return err
131	}
132	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
133		return err
134	}
135	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
136		return err
137	}
138	if err = addOpUpdateGameServerValidationMiddleware(stack); err != nil {
139		return err
140	}
141	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateGameServer(options.Region), middleware.Before); err != nil {
142		return err
143	}
144	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
145		return err
146	}
147	if err = addResponseErrorMiddleware(stack); err != nil {
148		return err
149	}
150	if err = addRequestResponseLogging(stack, options); err != nil {
151		return err
152	}
153	return nil
154}
155
156func newServiceMetadataMiddleware_opUpdateGameServer(region string) *awsmiddleware.RegisterServiceMetadata {
157	return &awsmiddleware.RegisterServiceMetadata{
158		Region:        region,
159		ServiceID:     ServiceID,
160		SigningName:   "gamelift",
161		OperationName: "UpdateGameServer",
162	}
163}
164