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// Updates the mutable properties of a game session. To update a game session,
15// specify the game session ID and the values you want to change. If successful,
16// the updated GameSession object is returned. Related actions CreateGameSession |
17// DescribeGameSessions | DescribeGameSessionDetails | SearchGameSessions |
18// UpdateGameSession | GetGameSessionLogUrl | StartGameSessionPlacement |
19// DescribeGameSessionPlacement | StopGameSessionPlacement | All APIs by task
20// (https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets)
21func (c *Client) UpdateGameSession(ctx context.Context, params *UpdateGameSessionInput, optFns ...func(*Options)) (*UpdateGameSessionOutput, error) {
22	if params == nil {
23		params = &UpdateGameSessionInput{}
24	}
25
26	result, metadata, err := c.invokeOperation(ctx, "UpdateGameSession", params, optFns, addOperationUpdateGameSessionMiddlewares)
27	if err != nil {
28		return nil, err
29	}
30
31	out := result.(*UpdateGameSessionOutput)
32	out.ResultMetadata = metadata
33	return out, nil
34}
35
36// Represents the input for a request operation.
37type UpdateGameSessionInput struct {
38
39	// A unique identifier for the game session to update.
40	//
41	// This member is required.
42	GameSessionId *string
43
44	// The maximum number of players that can be connected simultaneously to the game
45	// session.
46	MaximumPlayerSessionCount *int32
47
48	// A descriptive label that is associated with a game session. Session names do not
49	// need to be unique.
50	Name *string
51
52	// A policy that determines whether the game session is accepting new players.
53	PlayerSessionCreationPolicy types.PlayerSessionCreationPolicy
54
55	// Game session protection policy to apply to this game session only.
56	//
57	// *
58	// NoProtection -- The game session can be terminated during a scale-down event.
59	//
60	// *
61	// FullProtection -- If the game session is in an ACTIVE status, it cannot be
62	// terminated during a scale-down event.
63	ProtectionPolicy types.ProtectionPolicy
64}
65
66// Represents the returned data in response to a request operation.
67type UpdateGameSessionOutput struct {
68
69	// The updated game session properties.
70	GameSession *types.GameSession
71
72	// Metadata pertaining to the operation's result.
73	ResultMetadata middleware.Metadata
74}
75
76func addOperationUpdateGameSessionMiddlewares(stack *middleware.Stack, options Options) (err error) {
77	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateGameSession{}, middleware.After)
78	if err != nil {
79		return err
80	}
81	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateGameSession{}, middleware.After)
82	if err != nil {
83		return err
84	}
85	if err = addSetLoggerMiddleware(stack, options); err != nil {
86		return err
87	}
88	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
89		return err
90	}
91	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
92		return err
93	}
94	if err = addResolveEndpointMiddleware(stack, options); err != nil {
95		return err
96	}
97	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
98		return err
99	}
100	if err = addRetryMiddlewares(stack, options); err != nil {
101		return err
102	}
103	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
104		return err
105	}
106	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
107		return err
108	}
109	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
110		return err
111	}
112	if err = addClientUserAgent(stack); err != nil {
113		return err
114	}
115	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
116		return err
117	}
118	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
119		return err
120	}
121	if err = addOpUpdateGameSessionValidationMiddleware(stack); err != nil {
122		return err
123	}
124	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateGameSession(options.Region), middleware.Before); err != nil {
125		return err
126	}
127	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
128		return err
129	}
130	if err = addResponseErrorMiddleware(stack); err != nil {
131		return err
132	}
133	if err = addRequestResponseLogging(stack, options); err != nil {
134		return err
135	}
136	return nil
137}
138
139func newServiceMetadataMiddleware_opUpdateGameSession(region string) *awsmiddleware.RegisterServiceMetadata {
140	return &awsmiddleware.RegisterServiceMetadata{
141		Region:        region,
142		ServiceID:     ServiceID,
143		SigningName:   "gamelift",
144		OperationName: "UpdateGameSession",
145	}
146}
147