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 an alias for a fleet. In most situations, you can use an alias ID in 15// place of a fleet ID. An alias provides a level of abstraction for a fleet that 16// is useful when redirecting player traffic from one fleet to another, such as 17// when updating your game build. Amazon GameLift supports two types of routing 18// strategies for aliases: simple and terminal. A simple alias points to an active 19// fleet. A terminal alias is used to display messaging or link to a URL instead of 20// routing players to an active fleet. For example, you might use a terminal alias 21// when a game version is no longer supported and you want to direct players to an 22// upgrade site. To create a fleet alias, specify an alias name, routing strategy, 23// and optional description. Each simple alias can point to only one fleet, but a 24// fleet can have multiple aliases. If successful, a new alias record is returned, 25// including an alias ID and an ARN. You can reassign an alias to another fleet by 26// calling UpdateAlias. Related actions CreateAlias | ListAliases | DescribeAlias | 27// UpdateAlias | DeleteAlias | ResolveAlias | All APIs by task 28// (https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets) 29func (c *Client) CreateAlias(ctx context.Context, params *CreateAliasInput, optFns ...func(*Options)) (*CreateAliasOutput, error) { 30 if params == nil { 31 params = &CreateAliasInput{} 32 } 33 34 result, metadata, err := c.invokeOperation(ctx, "CreateAlias", params, optFns, c.addOperationCreateAliasMiddlewares) 35 if err != nil { 36 return nil, err 37 } 38 39 out := result.(*CreateAliasOutput) 40 out.ResultMetadata = metadata 41 return out, nil 42} 43 44// Represents the input for a request operation. 45type CreateAliasInput struct { 46 47 // A descriptive label that is associated with an alias. Alias names do not need to 48 // be unique. 49 // 50 // This member is required. 51 Name *string 52 53 // The routing configuration, including routing type and fleet target, for the 54 // alias. 55 // 56 // This member is required. 57 RoutingStrategy *types.RoutingStrategy 58 59 // A human-readable description of the alias. 60 Description *string 61 62 // A list of labels to assign to the new alias resource. Tags are developer-defined 63 // key-value pairs. Tagging AWS resources are useful for resource management, 64 // access management and cost allocation. For more information, see Tagging AWS 65 // Resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) in 66 // the AWS General Reference. Once the resource is created, you can use 67 // TagResource, UntagResource, and ListTagsForResource to add, remove, and view 68 // tags. The maximum tag limit may be lower than stated. See the AWS General 69 // Reference for actual tagging limits. 70 Tags []types.Tag 71 72 noSmithyDocumentSerde 73} 74 75// Represents the returned data in response to a request operation. 76type CreateAliasOutput struct { 77 78 // The newly created alias resource. 79 Alias *types.Alias 80 81 // Metadata pertaining to the operation's result. 82 ResultMetadata middleware.Metadata 83 84 noSmithyDocumentSerde 85} 86 87func (c *Client) addOperationCreateAliasMiddlewares(stack *middleware.Stack, options Options) (err error) { 88 err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateAlias{}, middleware.After) 89 if err != nil { 90 return err 91 } 92 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateAlias{}, middleware.After) 93 if err != nil { 94 return err 95 } 96 if err = addSetLoggerMiddleware(stack, options); err != nil { 97 return err 98 } 99 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 100 return err 101 } 102 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 103 return err 104 } 105 if err = addResolveEndpointMiddleware(stack, options); err != nil { 106 return err 107 } 108 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 109 return err 110 } 111 if err = addRetryMiddlewares(stack, options); err != nil { 112 return err 113 } 114 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 115 return err 116 } 117 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 118 return err 119 } 120 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 121 return err 122 } 123 if err = addClientUserAgent(stack); err != nil { 124 return err 125 } 126 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 127 return err 128 } 129 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 130 return err 131 } 132 if err = addOpCreateAliasValidationMiddleware(stack); err != nil { 133 return err 134 } 135 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAlias(options.Region), middleware.Before); err != nil { 136 return err 137 } 138 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 139 return err 140 } 141 if err = addResponseErrorMiddleware(stack); err != nil { 142 return err 143 } 144 if err = addRequestResponseLogging(stack, options); err != nil { 145 return err 146 } 147 return nil 148} 149 150func newServiceMetadataMiddleware_opCreateAlias(region string) *awsmiddleware.RegisterServiceMetadata { 151 return &awsmiddleware.RegisterServiceMetadata{ 152 Region: region, 153 ServiceID: ServiceID, 154 SigningName: "gamelift", 155 OperationName: "CreateAlias", 156 } 157} 158