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// Creates a deployment group to which application revisions are deployed.
15func (c *Client) CreateDeploymentGroup(ctx context.Context, params *CreateDeploymentGroupInput, optFns ...func(*Options)) (*CreateDeploymentGroupOutput, error) {
16	if params == nil {
17		params = &CreateDeploymentGroupInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateDeploymentGroup", params, optFns, addOperationCreateDeploymentGroupMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateDeploymentGroupOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30// Represents the input of a CreateDeploymentGroup operation.
31type CreateDeploymentGroupInput 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	// The name of a new deployment group for the specified application.
40	//
41	// This member is required.
42	DeploymentGroupName *string
43
44	// A service role Amazon Resource Name (ARN) that allows AWS CodeDeploy to act on
45	// the user's behalf when interacting with AWS services.
46	//
47	// This member is required.
48	ServiceRoleArn *string
49
50	// Information to add about Amazon CloudWatch alarms when the deployment group is
51	// created.
52	AlarmConfiguration *types.AlarmConfiguration
53
54	// Configuration information for an automatic rollback that is added when a
55	// deployment group is created.
56	AutoRollbackConfiguration *types.AutoRollbackConfiguration
57
58	// A list of associated Amazon EC2 Auto Scaling groups.
59	AutoScalingGroups []string
60
61	// Information about blue/green deployment options for a deployment group.
62	BlueGreenDeploymentConfiguration *types.BlueGreenDeploymentConfiguration
63
64	// If specified, the deployment configuration name can be either one of the
65	// predefined configurations provided with AWS CodeDeploy or a custom deployment
66	// configuration that you create by calling the create deployment configuration
67	// operation. CodeDeployDefault.OneAtATime is the default deployment configuration.
68	// It is used if a configuration isn't specified for the deployment or deployment
69	// group. For more information about the predefined deployment configurations in
70	// AWS CodeDeploy, see Working with Deployment Configurations in CodeDeploy
71	// (https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html)
72	// in the AWS CodeDeploy User Guide.
73	DeploymentConfigName *string
74
75	// Information about the type of deployment, in-place or blue/green, that you want
76	// to run and whether to route deployment traffic behind a load balancer.
77	DeploymentStyle *types.DeploymentStyle
78
79	// The Amazon EC2 tags on which to filter. The deployment group includes EC2
80	// instances with any of the specified tags. Cannot be used in the same call as
81	// ec2TagSet.
82	Ec2TagFilters []types.EC2TagFilter
83
84	// Information about groups of tags applied to EC2 instances. The deployment group
85	// includes only EC2 instances identified by all the tag groups. Cannot be used in
86	// the same call as ec2TagFilters.
87	Ec2TagSet *types.EC2TagSet
88
89	// The target Amazon ECS services in the deployment group. This applies only to
90	// deployment groups that use the Amazon ECS compute platform. A target Amazon ECS
91	// service is specified as an Amazon ECS cluster and service name pair using the
92	// format :.
93	EcsServices []types.ECSService
94
95	// Information about the load balancer used in a deployment.
96	LoadBalancerInfo *types.LoadBalancerInfo
97
98	// The on-premises instance tags on which to filter. The deployment group includes
99	// on-premises instances with any of the specified tags. Cannot be used in the same
100	// call as OnPremisesTagSet.
101	OnPremisesInstanceTagFilters []types.TagFilter
102
103	// Information about groups of tags applied to on-premises instances. The
104	// deployment group includes only on-premises instances identified by all of the
105	// tag groups. Cannot be used in the same call as onPremisesInstanceTagFilters.
106	OnPremisesTagSet *types.OnPremisesTagSet
107
108	// Indicates what happens when new EC2 instances are launched mid-deployment and do
109	// not receive the deployed application revision. If this option is set to UPDATE
110	// or is unspecified, CodeDeploy initiates one or more 'auto-update outdated
111	// instances' deployments to apply the deployed application revision to the new EC2
112	// instances. If this option is set to IGNORE, CodeDeploy does not initiate a
113	// deployment to update the new EC2 instances. This may result in instances having
114	// different revisions.
115	OutdatedInstancesStrategy types.OutdatedInstancesStrategy
116
117	// The metadata that you apply to CodeDeploy deployment groups to help you organize
118	// and categorize them. Each tag consists of a key and an optional value, both of
119	// which you define.
120	Tags []types.Tag
121
122	// Information about triggers to create when the deployment group is created. For
123	// examples, see Create a Trigger for an AWS CodeDeploy Event
124	// (https://docs.aws.amazon.com/codedeploy/latest/userguide/how-to-notify-sns.html)
125	// in the AWS CodeDeploy User Guide.
126	TriggerConfigurations []types.TriggerConfig
127}
128
129// Represents the output of a CreateDeploymentGroup operation.
130type CreateDeploymentGroupOutput struct {
131
132	// A unique deployment group ID.
133	DeploymentGroupId *string
134
135	// Metadata pertaining to the operation's result.
136	ResultMetadata middleware.Metadata
137}
138
139func addOperationCreateDeploymentGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
140	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateDeploymentGroup{}, middleware.After)
141	if err != nil {
142		return err
143	}
144	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateDeploymentGroup{}, middleware.After)
145	if err != nil {
146		return err
147	}
148	if err = addSetLoggerMiddleware(stack, options); err != nil {
149		return err
150	}
151	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
152		return err
153	}
154	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
155		return err
156	}
157	if err = addResolveEndpointMiddleware(stack, options); err != nil {
158		return err
159	}
160	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
161		return err
162	}
163	if err = addRetryMiddlewares(stack, options); err != nil {
164		return err
165	}
166	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
167		return err
168	}
169	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
170		return err
171	}
172	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
173		return err
174	}
175	if err = addClientUserAgent(stack); err != nil {
176		return err
177	}
178	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
179		return err
180	}
181	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
182		return err
183	}
184	if err = addOpCreateDeploymentGroupValidationMiddleware(stack); err != nil {
185		return err
186	}
187	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDeploymentGroup(options.Region), middleware.Before); err != nil {
188		return err
189	}
190	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
191		return err
192	}
193	if err = addResponseErrorMiddleware(stack); err != nil {
194		return err
195	}
196	if err = addRequestResponseLogging(stack, options); err != nil {
197		return err
198	}
199	return nil
200}
201
202func newServiceMetadataMiddleware_opCreateDeploymentGroup(region string) *awsmiddleware.RegisterServiceMetadata {
203	return &awsmiddleware.RegisterServiceMetadata{
204		Region:        region,
205		ServiceID:     ServiceID,
206		SigningName:   "codedeploy",
207		OperationName: "CreateDeploymentGroup",
208	}
209}
210