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. Temporarily stops activity on a game server group without terminating
16// instances or the game server group. You can restart activity by calling
17// ResumeGameServerGroup. You can suspend the following activity:
18//
19// * Instance type
20// replacement - This activity evaluates the current game hosting viability of all
21// Spot instance types that are defined for the game server group. It updates the
22// Auto Scaling group to remove nonviable Spot Instance types, which have a higher
23// chance of game server interruptions. It then balances capacity across the
24// remaining viable Spot Instance types. When this activity is suspended, the Auto
25// Scaling group continues with its current balance, regardless of viability.
26// Instance protection, utilization metrics, and capacity scaling activities
27// continue to be active.
28//
29// To suspend activity, specify a game server group ARN and
30// the type of activity to be suspended. If successful, a GameServerGroup object is
31// returned showing that the activity is listed in SuspendedActions. Learn more
32// GameLift FleetIQ Guide
33// (https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-intro.html)
34// Related actions CreateGameServerGroup | ListGameServerGroups |
35// DescribeGameServerGroup | UpdateGameServerGroup | DeleteGameServerGroup |
36// ResumeGameServerGroup | SuspendGameServerGroup | DescribeGameServerInstances |
37// All APIs by task
38// (https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/reference-awssdk-fleetiq.html)
39func (c *Client) SuspendGameServerGroup(ctx context.Context, params *SuspendGameServerGroupInput, optFns ...func(*Options)) (*SuspendGameServerGroupOutput, error) {
40	if params == nil {
41		params = &SuspendGameServerGroupInput{}
42	}
43
44	result, metadata, err := c.invokeOperation(ctx, "SuspendGameServerGroup", params, optFns, c.addOperationSuspendGameServerGroupMiddlewares)
45	if err != nil {
46		return nil, err
47	}
48
49	out := result.(*SuspendGameServerGroupOutput)
50	out.ResultMetadata = metadata
51	return out, nil
52}
53
54type SuspendGameServerGroupInput struct {
55
56	// A unique identifier for the game server group. Use either the GameServerGroup
57	// name or ARN value.
58	//
59	// This member is required.
60	GameServerGroupName *string
61
62	// The activity to suspend for this game server group.
63	//
64	// This member is required.
65	SuspendActions []types.GameServerGroupAction
66
67	noSmithyDocumentSerde
68}
69
70type SuspendGameServerGroupOutput struct {
71
72	// An object that describes the game server group resource, with the
73	// SuspendedActions property updated to reflect the suspended activity.
74	GameServerGroup *types.GameServerGroup
75
76	// Metadata pertaining to the operation's result.
77	ResultMetadata middleware.Metadata
78
79	noSmithyDocumentSerde
80}
81
82func (c *Client) addOperationSuspendGameServerGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
83	err = stack.Serialize.Add(&awsAwsjson11_serializeOpSuspendGameServerGroup{}, middleware.After)
84	if err != nil {
85		return err
86	}
87	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpSuspendGameServerGroup{}, middleware.After)
88	if err != nil {
89		return err
90	}
91	if err = addSetLoggerMiddleware(stack, options); err != nil {
92		return err
93	}
94	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
95		return err
96	}
97	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
98		return err
99	}
100	if err = addResolveEndpointMiddleware(stack, options); err != nil {
101		return err
102	}
103	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
104		return err
105	}
106	if err = addRetryMiddlewares(stack, options); err != nil {
107		return err
108	}
109	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
110		return err
111	}
112	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
113		return err
114	}
115	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
116		return err
117	}
118	if err = addClientUserAgent(stack); err != nil {
119		return err
120	}
121	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
122		return err
123	}
124	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
125		return err
126	}
127	if err = addOpSuspendGameServerGroupValidationMiddleware(stack); err != nil {
128		return err
129	}
130	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSuspendGameServerGroup(options.Region), middleware.Before); err != nil {
131		return err
132	}
133	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
134		return err
135	}
136	if err = addResponseErrorMiddleware(stack); err != nil {
137		return err
138	}
139	if err = addRequestResponseLogging(stack, options); err != nil {
140		return err
141	}
142	return nil
143}
144
145func newServiceMetadataMiddleware_opSuspendGameServerGroup(region string) *awsmiddleware.RegisterServiceMetadata {
146	return &awsmiddleware.RegisterServiceMetadata{
147		Region:        region,
148		ServiceID:     ServiceID,
149		SigningName:   "gamelift",
150		OperationName: "SuspendGameServerGroup",
151	}
152}
153