1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package codedeploy 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/codedeploy/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Deploys an application revision through the specified deployment group. 15func (c *Client) CreateDeployment(ctx context.Context, params *CreateDeploymentInput, optFns ...func(*Options)) (*CreateDeploymentOutput, error) { 16 if params == nil { 17 params = &CreateDeploymentInput{} 18 } 19 20 result, metadata, err := c.invokeOperation(ctx, "CreateDeployment", params, optFns, addOperationCreateDeploymentMiddlewares) 21 if err != nil { 22 return nil, err 23 } 24 25 out := result.(*CreateDeploymentOutput) 26 out.ResultMetadata = metadata 27 return out, nil 28} 29 30// Represents the input of a CreateDeployment operation. 31type CreateDeploymentInput struct { 32 33 // The name of an AWS CodeDeploy application associated with the IAM user or AWS 34 // account. 35 // 36 // This member is required. 37 ApplicationName *string 38 39 // Configuration information for an automatic rollback that is added when a 40 // deployment is created. 41 AutoRollbackConfiguration *types.AutoRollbackConfiguration 42 43 // The name of a deployment configuration associated with the IAM user or AWS 44 // account. If not specified, the value configured in the deployment group is used 45 // as the default. If the deployment group does not have a deployment configuration 46 // associated with it, CodeDeployDefault.OneAtATime is used by default. 47 DeploymentConfigName *string 48 49 // The name of the deployment group. 50 DeploymentGroupName *string 51 52 // A comment about the deployment. 53 Description *string 54 55 // Information about how AWS CodeDeploy handles files that already exist in a 56 // deployment target location but weren't part of the previous successful 57 // deployment. The fileExistsBehavior parameter takes any of the following 58 // values: 59 // 60 // * DISALLOW: The deployment fails. This is also the default behavior if 61 // no option is specified. 62 // 63 // * OVERWRITE: The version of the file from the 64 // application revision currently being deployed replaces the version already on 65 // the instance. 66 // 67 // * RETAIN: The version of the file already on the instance is kept 68 // and used as part of the new deployment. 69 FileExistsBehavior types.FileExistsBehavior 70 71 // If true, then if an ApplicationStop, BeforeBlockTraffic, or AfterBlockTraffic 72 // deployment lifecycle event to an instance fails, then the deployment continues 73 // to the next deployment lifecycle event. For example, if ApplicationStop fails, 74 // the deployment continues with DownloadBundle. If BeforeBlockTraffic fails, the 75 // deployment continues with BlockTraffic. If AfterBlockTraffic fails, the 76 // deployment continues with ApplicationStop. If false or not specified, then if a 77 // lifecycle event fails during a deployment to an instance, that deployment fails. 78 // If deployment to that instance is part of an overall deployment and the number 79 // of healthy hosts is not less than the minimum number of healthy hosts, then a 80 // deployment to the next instance is attempted. During a deployment, the AWS 81 // CodeDeploy agent runs the scripts specified for ApplicationStop, 82 // BeforeBlockTraffic, and AfterBlockTraffic in the AppSpec file from the previous 83 // successful deployment. (All other scripts are run from the AppSpec file in the 84 // current deployment.) If one of these scripts contains an error and does not run 85 // successfully, the deployment can fail. If the cause of the failure is a script 86 // from the last successful deployment that will never run successfully, create a 87 // new deployment and use ignoreApplicationStopFailures to specify that the 88 // ApplicationStop, BeforeBlockTraffic, and AfterBlockTraffic failures should be 89 // ignored. 90 IgnoreApplicationStopFailures bool 91 92 // The type and location of the revision to deploy. 93 Revision *types.RevisionLocation 94 95 // Information about the instances that belong to the replacement environment in a 96 // blue/green deployment. 97 TargetInstances *types.TargetInstances 98 99 // Indicates whether to deploy to all instances or only to instances that are not 100 // running the latest application revision. 101 UpdateOutdatedInstancesOnly bool 102} 103 104// Represents the output of a CreateDeployment operation. 105type CreateDeploymentOutput struct { 106 107 // The unique ID of a deployment. 108 DeploymentId *string 109 110 // Metadata pertaining to the operation's result. 111 ResultMetadata middleware.Metadata 112} 113 114func addOperationCreateDeploymentMiddlewares(stack *middleware.Stack, options Options) (err error) { 115 err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateDeployment{}, middleware.After) 116 if err != nil { 117 return err 118 } 119 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateDeployment{}, middleware.After) 120 if err != nil { 121 return err 122 } 123 if err = addSetLoggerMiddleware(stack, options); err != nil { 124 return err 125 } 126 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 127 return err 128 } 129 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 130 return err 131 } 132 if err = addResolveEndpointMiddleware(stack, options); err != nil { 133 return err 134 } 135 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 136 return err 137 } 138 if err = addRetryMiddlewares(stack, options); err != nil { 139 return err 140 } 141 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 142 return err 143 } 144 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 145 return err 146 } 147 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 148 return err 149 } 150 if err = addClientUserAgent(stack); err != nil { 151 return err 152 } 153 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 154 return err 155 } 156 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 157 return err 158 } 159 if err = addOpCreateDeploymentValidationMiddleware(stack); err != nil { 160 return err 161 } 162 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDeployment(options.Region), middleware.Before); err != nil { 163 return err 164 } 165 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 166 return err 167 } 168 if err = addResponseErrorMiddleware(stack); err != nil { 169 return err 170 } 171 if err = addRequestResponseLogging(stack, options); err != nil { 172 return err 173 } 174 return nil 175} 176 177func newServiceMetadataMiddleware_opCreateDeployment(region string) *awsmiddleware.RegisterServiceMetadata { 178 return &awsmiddleware.RegisterServiceMetadata{ 179 Region: region, 180 ServiceID: ServiceID, 181 SigningName: "codedeploy", 182 OperationName: "CreateDeployment", 183 } 184} 185