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 Amazon GameLift build resource for your game server binary files. 15// Game server binaries must be combined into a zip file for use with Amazon 16// GameLift. When setting up a new game build for GameLift, we recommend using the 17// AWS CLI command upload-build 18// (https://docs.aws.amazon.com/cli/latest/reference/gamelift/upload-build.html) . 19// This helper command combines two tasks: (1) it uploads your build files from a 20// file directory to a GameLift Amazon S3 location, and (2) it creates a new build 21// resource. The CreateBuild operation can used in the following scenarios: 22// 23// * To 24// create a new game build with build files that are in an S3 location under an AWS 25// account that you control. To use this option, you must first give Amazon 26// GameLift access to the S3 bucket. With permissions in place, call CreateBuild 27// and specify a build name, operating system, and the S3 storage location of your 28// game build. 29// 30// * To directly upload your build files to a GameLift S3 location. To 31// use this option, first call CreateBuild and specify a build name and operating 32// system. This operation creates a new build resource and also returns an S3 33// location with temporary access credentials. Use the credentials to manually 34// upload your build files to the specified S3 location. For more information, see 35// Uploading Objects 36// (https://docs.aws.amazon.com/AmazonS3/latest/dev/UploadingObjects.html) in the 37// Amazon S3 Developer Guide. Build files can be uploaded to the GameLift S3 38// location once only; that can't be updated. 39// 40// If successful, this operation 41// creates a new build resource with a unique build ID and places it in INITIALIZED 42// status. A build must be in READY status before you can create fleets with it. 43// Learn more Uploading Your Game 44// (https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-build-intro.html) 45// Create a Build with Files in Amazon S3 46// (https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-build-cli-uploading.html#gamelift-build-cli-uploading-create-build) 47// Related operations 48// 49// * CreateBuild 50// 51// * ListBuilds 52// 53// * DescribeBuild 54// 55// * 56// UpdateBuild 57// 58// * DeleteBuild 59func (c *Client) CreateBuild(ctx context.Context, params *CreateBuildInput, optFns ...func(*Options)) (*CreateBuildOutput, error) { 60 if params == nil { 61 params = &CreateBuildInput{} 62 } 63 64 result, metadata, err := c.invokeOperation(ctx, "CreateBuild", params, optFns, addOperationCreateBuildMiddlewares) 65 if err != nil { 66 return nil, err 67 } 68 69 out := result.(*CreateBuildOutput) 70 out.ResultMetadata = metadata 71 return out, nil 72} 73 74// Represents the input for a request operation. 75type CreateBuildInput struct { 76 77 // A descriptive label that is associated with a build. Build names do not need to 78 // be unique. You can use UpdateBuild to change this value later. 79 Name *string 80 81 // The operating system that the game server binaries are built to run on. This 82 // value determines the type of fleet resources that you can use for this build. If 83 // your game build contains multiple executables, they all must run on the same 84 // operating system. If an operating system is not specified when creating a build, 85 // Amazon GameLift uses the default value (WINDOWS_2012). This value cannot be 86 // changed later. 87 OperatingSystem types.OperatingSystem 88 89 // The location where your game build files are stored. Use this parameter only 90 // when creating a build using files that are stored in an S3 bucket that you own. 91 // Identify an S3 bucket name and key, which must in the same Region where you're 92 // creating a build. This parameter must also specify the ARN for an IAM role that 93 // you've set up to give Amazon GameLift access your S3 bucket. To call this 94 // operation with a storage location, you must have IAM PassRole permission. For 95 // more details on IAM roles and PassRole permissions, see Set up a role for 96 // GameLift access 97 // (https://docs.aws.amazon.com/gamelift/latest/developerguide/setting-up-role.html). 98 StorageLocation *types.S3Location 99 100 // A list of labels to assign to the new build resource. Tags are developer-defined 101 // key-value pairs. Tagging AWS resources are useful for resource management, 102 // access management and cost allocation. For more information, see Tagging AWS 103 // Resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) in 104 // the AWS General Reference. Once the resource is created, you can use 105 // TagResource, UntagResource, and ListTagsForResource to add, remove, and view 106 // tags. The maximum tag limit may be lower than stated. See the AWS General 107 // Reference for actual tagging limits. 108 Tags []types.Tag 109 110 // Version information that is associated with a build or script. Version strings 111 // do not need to be unique. You can use UpdateBuild to change this value later. 112 Version *string 113} 114 115// Represents the returned data in response to a request operation. 116type CreateBuildOutput struct { 117 118 // The newly created build resource, including a unique build IDs and status. 119 Build *types.Build 120 121 // Amazon S3 location for your game build file, including bucket name and key. 122 StorageLocation *types.S3Location 123 124 // This element is returned only when the operation is called without a storage 125 // location. It contains credentials to use when you are uploading a build file to 126 // an S3 bucket that is owned by Amazon GameLift. Credentials have a limited life 127 // span. To refresh these credentials, call RequestUploadCredentials. 128 UploadCredentials *types.AwsCredentials 129 130 // Metadata pertaining to the operation's result. 131 ResultMetadata middleware.Metadata 132} 133 134func addOperationCreateBuildMiddlewares(stack *middleware.Stack, options Options) (err error) { 135 err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateBuild{}, middleware.After) 136 if err != nil { 137 return err 138 } 139 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateBuild{}, middleware.After) 140 if err != nil { 141 return err 142 } 143 if err = addSetLoggerMiddleware(stack, options); err != nil { 144 return err 145 } 146 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 147 return err 148 } 149 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 150 return err 151 } 152 if err = addResolveEndpointMiddleware(stack, options); err != nil { 153 return err 154 } 155 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 156 return err 157 } 158 if err = addRetryMiddlewares(stack, options); err != nil { 159 return err 160 } 161 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 162 return err 163 } 164 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 165 return err 166 } 167 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 168 return err 169 } 170 if err = addClientUserAgent(stack); err != nil { 171 return err 172 } 173 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 174 return err 175 } 176 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 177 return err 178 } 179 if err = addOpCreateBuildValidationMiddleware(stack); err != nil { 180 return err 181 } 182 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateBuild(options.Region), middleware.Before); err != nil { 183 return err 184 } 185 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 186 return err 187 } 188 if err = addResponseErrorMiddleware(stack); err != nil { 189 return err 190 } 191 if err = addRequestResponseLogging(stack, options); err != nil { 192 return err 193 } 194 return nil 195} 196 197func newServiceMetadataMiddleware_opCreateBuild(region string) *awsmiddleware.RegisterServiceMetadata { 198 return &awsmiddleware.RegisterServiceMetadata{ 199 Region: region, 200 ServiceID: ServiceID, 201 SigningName: "gamelift", 202 OperationName: "CreateBuild", 203 } 204} 205