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// Creates a new fleet to run your game servers. whether they are custom game 15// builds or Realtime Servers with game-specific script. A fleet is a set of Amazon 16// Elastic Compute Cloud (Amazon EC2) instances, each of which can host multiple 17// game sessions. When creating a fleet, you choose the hardware specifications, 18// set some configuration options, and specify the game server to deploy on the new 19// fleet. To create a new fleet, provide the following: (1) a fleet name, (2) an 20// EC2 instance type and fleet type (spot or on-demand), (3) the build ID for your 21// game build or script ID if using Realtime Servers, and (4) a runtime 22// configuration, which determines how game servers will run on each instance in 23// the fleet. If the CreateFleet call is successful, Amazon GameLift performs the 24// following tasks. You can track the process of a fleet by checking the fleet 25// status or by monitoring fleet creation events: 26// 27// * Creates a fleet resource. 28// Status: NEW. 29// 30// * Begins writing events to the fleet event log, which can be 31// accessed in the Amazon GameLift console. 32// 33// * Sets the fleet's target capacity to 34// 1 (desired instances), which triggers Amazon GameLift to start one new EC2 35// instance. 36// 37// * Downloads the game build or Realtime script to the new instance and 38// installs it. Statuses: DOWNLOADING, VALIDATING, BUILDING. 39// 40// * Starts launching 41// server processes on the instance. If the fleet is configured to run multiple 42// server processes per instance, Amazon GameLift staggers each process launch by a 43// few seconds. Status: ACTIVATING. 44// 45// * Sets the fleet's status to ACTIVE as soon as 46// one server process is ready to host a game session. 47// 48// Learn more Setting Up 49// Fleets 50// (https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-intro.html)Debug 51// Fleet Creation Issues 52// (https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-creating-debug.html#fleets-creating-debug-creation) 53// Related operations 54// 55// * CreateFleet 56// 57// * ListFleets 58// 59// * DeleteFleet 60// 61// * 62// DescribeFleetAttributes 63// 64// * UpdateFleetAttributes 65// 66// * StartFleetActions or 67// StopFleetActions 68func (c *Client) CreateFleet(ctx context.Context, params *CreateFleetInput, optFns ...func(*Options)) (*CreateFleetOutput, error) { 69 if params == nil { 70 params = &CreateFleetInput{} 71 } 72 73 result, metadata, err := c.invokeOperation(ctx, "CreateFleet", params, optFns, addOperationCreateFleetMiddlewares) 74 if err != nil { 75 return nil, err 76 } 77 78 out := result.(*CreateFleetOutput) 79 out.ResultMetadata = metadata 80 return out, nil 81} 82 83// Represents the input for a request operation. 84type CreateFleetInput struct { 85 86 // The name of an EC2 instance type that is supported in Amazon GameLift. A fleet 87 // instance type determines the computing resources of each instance in the fleet, 88 // including CPU, memory, storage, and networking capacity. Amazon GameLift 89 // supports the following EC2 instance types. See Amazon EC2 Instance Types 90 // (http://aws.amazon.com/ec2/instance-types/) for detailed descriptions. 91 // 92 // This member is required. 93 EC2InstanceType types.EC2InstanceType 94 95 // A descriptive label that is associated with a fleet. Fleet names do not need to 96 // be unique. 97 // 98 // This member is required. 99 Name *string 100 101 // A unique identifier for a build to be deployed on the new fleet. You can use 102 // either the build ID or ARN value. The custom game server build must have been 103 // successfully uploaded to Amazon GameLift and be in a READY status. This fleet 104 // setting cannot be changed once the fleet is created. 105 BuildId *string 106 107 // Indicates whether to generate a TLS/SSL certificate for the new fleet. TLS 108 // certificates are used for encrypting traffic between game clients and game 109 // servers running on GameLift. If this parameter is not specified, the default 110 // value, DISABLED, is used. This fleet setting cannot be changed once the fleet is 111 // created. Learn more at Securing Client/Server Communication 112 // (https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-howitworks.html#gamelift-howitworks-security). 113 // Note: This feature requires the AWS Certificate Manager (ACM) service, which is 114 // available in the AWS global partition but not in all other partitions. When 115 // working in a partition that does not support this feature, a request for a new 116 // fleet with certificate generation results fails with a 4xx unsupported Region 117 // error. Valid values include: 118 // 119 // * GENERATED - Generate a TLS/SSL certificate for 120 // this fleet. 121 // 122 // * DISABLED - (default) Do not generate a TLS/SSL certificate for 123 // this fleet. 124 CertificateConfiguration *types.CertificateConfiguration 125 126 // A human-readable description of a fleet. 127 Description *string 128 129 // Range of IP addresses and port settings that permit inbound traffic to access 130 // game sessions that are running on the fleet. For fleets using a custom game 131 // build, this parameter is required before game sessions running on the fleet can 132 // accept connections. For Realtime Servers fleets, Amazon GameLift automatically 133 // sets TCP and UDP ranges for use by the Realtime servers. You can specify 134 // multiple permission settings or add more by updating the fleet. 135 EC2InboundPermissions []types.IpPermission 136 137 // Indicates whether to use On-Demand instances or Spot instances for this fleet. 138 // If empty, the default is ON_DEMAND. Both categories of instances use identical 139 // hardware and configurations based on the instance type selected for this fleet. 140 // Learn more about On-Demand versus Spot Instances 141 // (https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-ec2-instances.html#gamelift-ec2-instances-spot). 142 FleetType types.FleetType 143 144 // A unique identifier for an AWS IAM role that manages access to your AWS 145 // services. Fleets with an instance role ARN allow applications that are running 146 // on the fleet's instances to assume the role. Learn more about using on-box 147 // credentials for your game servers at Access external resources from a game 148 // server 149 // (https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-resources.html). 150 // To call this operation with instance role ARN, you must have IAM PassRole 151 // permissions. See IAM policy examples for GameLift 152 // (https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-iam-policy-examples.html). 153 InstanceRoleArn *string 154 155 // This parameter is no longer used. Instead, to specify where Amazon GameLift 156 // should store log files once a server process shuts down, use the Amazon GameLift 157 // server API ProcessReady() and specify one or more directory paths in 158 // logParameters. See more information in the Server API Reference 159 // (https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api-ref.html#gamelift-sdk-server-api-ref-dataypes-process). 160 LogPaths []string 161 162 // The name of an Amazon CloudWatch metric group to add this fleet to. A metric 163 // group aggregates the metrics for all fleets in the group. Specify an existing 164 // metric group name, or provide a new name to create a new metric group. A fleet 165 // can only be included in one metric group at a time. 166 MetricGroups []string 167 168 // A game session protection policy to apply to all instances in this fleet. If 169 // this parameter is not set, instances in this fleet default to no protection. You 170 // can change a fleet's protection policy using UpdateFleetAttributes, but this 171 // change will only affect sessions created after the policy change. You can also 172 // set protection for individual instances using UpdateGameSession. 173 // 174 // * NoProtection 175 // - The game session can be terminated during a scale-down event. 176 // 177 // * 178 // FullProtection - If the game session is in an ACTIVE status, it cannot be 179 // terminated during a scale-down event. 180 NewGameSessionProtectionPolicy types.ProtectionPolicy 181 182 // A unique identifier for the AWS account with the VPC that you want to peer your 183 // Amazon GameLift fleet with. You can find your account ID in the AWS Management 184 // Console under account settings. 185 PeerVpcAwsAccountId *string 186 187 // A unique identifier for a VPC with resources to be accessed by your Amazon 188 // GameLift fleet. The VPC must be in the same Region as your fleet. To look up a 189 // VPC ID, use the VPC Dashboard (https://console.aws.amazon.com/vpc/) in the AWS 190 // Management Console. Learn more about VPC peering in VPC Peering with Amazon 191 // GameLift Fleets 192 // (https://docs.aws.amazon.com/gamelift/latest/developerguide/vpc-peering.html). 193 PeerVpcId *string 194 195 // A policy that limits the number of game sessions an individual player can create 196 // over a span of time for this fleet. 197 ResourceCreationLimitPolicy *types.ResourceCreationLimitPolicy 198 199 // Instructions for launching server processes on each instance in the fleet. 200 // Server processes run either a custom game build executable or a Realtime script. 201 // The runtime configuration defines the server executables or launch script file, 202 // launch parameters, and the number of processes to run concurrently on each 203 // instance. When creating a fleet, the runtime configuration must have at least 204 // one server process configuration; otherwise the request fails with an invalid 205 // request exception. (This parameter replaces the parameters ServerLaunchPath and 206 // ServerLaunchParameters, although requests that contain values for these 207 // parameters instead of a runtime configuration will continue to work.) This 208 // parameter is required unless the parameters ServerLaunchPath and 209 // ServerLaunchParameters are defined. Runtime configuration replaced these 210 // parameters, but fleets that use them will continue to work. 211 RuntimeConfiguration *types.RuntimeConfiguration 212 213 // A unique identifier for a Realtime script to be deployed on the new fleet. You 214 // can use either the script ID or ARN value. The Realtime script must have been 215 // successfully uploaded to Amazon GameLift. This fleet setting cannot be changed 216 // once the fleet is created. 217 ScriptId *string 218 219 // This parameter is no longer used. Instead, specify server launch parameters in 220 // the RuntimeConfiguration parameter. (Requests that specify a server launch path 221 // and launch parameters instead of a runtime configuration will continue to work.) 222 ServerLaunchParameters *string 223 224 // This parameter is no longer used. Instead, specify a server launch path using 225 // the RuntimeConfiguration parameter. Requests that specify a server launch path 226 // and launch parameters instead of a runtime configuration will continue to work. 227 ServerLaunchPath *string 228 229 // A list of labels to assign to the new fleet resource. Tags are developer-defined 230 // key-value pairs. Tagging AWS resources are useful for resource management, 231 // access management and cost allocation. For more information, see Tagging AWS 232 // Resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) in 233 // the AWS General Reference. Once the resource is created, you can use 234 // TagResource, UntagResource, and ListTagsForResource to add, remove, and view 235 // tags. The maximum tag limit may be lower than stated. See the AWS General 236 // Reference for actual tagging limits. 237 Tags []types.Tag 238} 239 240// Represents the returned data in response to a request operation. 241type CreateFleetOutput struct { 242 243 // Properties for the newly created fleet. 244 FleetAttributes *types.FleetAttributes 245 246 // Metadata pertaining to the operation's result. 247 ResultMetadata middleware.Metadata 248} 249 250func addOperationCreateFleetMiddlewares(stack *middleware.Stack, options Options) (err error) { 251 err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateFleet{}, middleware.After) 252 if err != nil { 253 return err 254 } 255 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateFleet{}, middleware.After) 256 if err != nil { 257 return err 258 } 259 if err = addSetLoggerMiddleware(stack, options); err != nil { 260 return err 261 } 262 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 263 return err 264 } 265 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 266 return err 267 } 268 if err = addResolveEndpointMiddleware(stack, options); err != nil { 269 return err 270 } 271 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 272 return err 273 } 274 if err = addRetryMiddlewares(stack, options); err != nil { 275 return err 276 } 277 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 278 return err 279 } 280 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 281 return err 282 } 283 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 284 return err 285 } 286 if err = addClientUserAgent(stack); err != nil { 287 return err 288 } 289 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 290 return err 291 } 292 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 293 return err 294 } 295 if err = addOpCreateFleetValidationMiddleware(stack); err != nil { 296 return err 297 } 298 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateFleet(options.Region), middleware.Before); err != nil { 299 return err 300 } 301 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 302 return err 303 } 304 if err = addResponseErrorMiddleware(stack); err != nil { 305 return err 306 } 307 if err = addRequestResponseLogging(stack, options); err != nil { 308 return err 309 } 310 return nil 311} 312 313func newServiceMetadataMiddleware_opCreateFleet(region string) *awsmiddleware.RegisterServiceMetadata { 314 return &awsmiddleware.RegisterServiceMetadata{ 315 Region: region, 316 ServiceID: ServiceID, 317 SigningName: "gamelift", 318 OperationName: "CreateFleet", 319 } 320} 321