1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package appconfig
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/appconfig/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// A deployment strategy defines important criteria for rolling out your
15// configuration to the designated targets. A deployment strategy includes: the
16// overall duration required, a percentage of targets to receive the deployment
17// during each interval, an algorithm that defines how percentage grows, and bake
18// time.
19func (c *Client) CreateDeploymentStrategy(ctx context.Context, params *CreateDeploymentStrategyInput, optFns ...func(*Options)) (*CreateDeploymentStrategyOutput, error) {
20	if params == nil {
21		params = &CreateDeploymentStrategyInput{}
22	}
23
24	result, metadata, err := c.invokeOperation(ctx, "CreateDeploymentStrategy", params, optFns, addOperationCreateDeploymentStrategyMiddlewares)
25	if err != nil {
26		return nil, err
27	}
28
29	out := result.(*CreateDeploymentStrategyOutput)
30	out.ResultMetadata = metadata
31	return out, nil
32}
33
34type CreateDeploymentStrategyInput struct {
35
36	// Total amount of time for a deployment to last.
37	//
38	// This member is required.
39	DeploymentDurationInMinutes int32
40
41	// The percentage of targets to receive a deployed configuration during each
42	// interval.
43	//
44	// This member is required.
45	GrowthFactor float32
46
47	// A name for the deployment strategy.
48	//
49	// This member is required.
50	Name *string
51
52	// Save the deployment strategy to a Systems Manager (SSM) document.
53	//
54	// This member is required.
55	ReplicateTo types.ReplicateTo
56
57	// A description of the deployment strategy.
58	Description *string
59
60	// The amount of time AppConfig monitors for alarms before considering the
61	// deployment to be complete and no longer eligible for automatic roll back.
62	FinalBakeTimeInMinutes int32
63
64	// The algorithm used to define how percentage grows over time. AWS AppConfig
65	// supports the following growth types: Linear: For this type, AppConfig processes
66	// the deployment by dividing the total number of targets by the value specified
67	// for Step percentage. For example, a linear deployment that uses a Step
68	// percentage of 10 deploys the configuration to 10 percent of the hosts. After
69	// those deployments are complete, the system deploys the configuration to the next
70	// 10 percent. This continues until 100% of the targets have successfully received
71	// the configuration. Exponential: For this type, AppConfig processes the
72	// deployment exponentially using the following formula: G*(2^N). In this formula,
73	// G is the growth factor specified by the user and N is the number of steps until
74	// the configuration is deployed to all targets. For example, if you specify a
75	// growth factor of 2, then the system rolls out the configuration as follows:
76	// 2*(2^0)
77	//     2*(2^1)
78	//
79	// 2*(2^2) Expressed numerically, the deployment rolls out as
80	// follows: 2% of the targets, 4% of the targets, 8% of the targets, and continues
81	// until the configuration has been deployed to all targets.
82	GrowthType types.GrowthType
83
84	// Metadata to assign to the deployment strategy. Tags help organize and categorize
85	// your AppConfig resources. Each tag consists of a key and an optional value, both
86	// of which you define.
87	Tags map[string]string
88}
89
90type CreateDeploymentStrategyOutput struct {
91
92	// Total amount of time the deployment lasted.
93	DeploymentDurationInMinutes int32
94
95	// The description of the deployment strategy.
96	Description *string
97
98	// The amount of time AppConfig monitored for alarms before considering the
99	// deployment to be complete and no longer eligible for automatic roll back.
100	FinalBakeTimeInMinutes int32
101
102	// The percentage of targets that received a deployed configuration during each
103	// interval.
104	GrowthFactor float32
105
106	// The algorithm used to define how percentage grew over time.
107	GrowthType types.GrowthType
108
109	// The deployment strategy ID.
110	Id *string
111
112	// The name of the deployment strategy.
113	Name *string
114
115	// Save the deployment strategy to a Systems Manager (SSM) document.
116	ReplicateTo types.ReplicateTo
117
118	// Metadata pertaining to the operation's result.
119	ResultMetadata middleware.Metadata
120}
121
122func addOperationCreateDeploymentStrategyMiddlewares(stack *middleware.Stack, options Options) (err error) {
123	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateDeploymentStrategy{}, middleware.After)
124	if err != nil {
125		return err
126	}
127	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateDeploymentStrategy{}, middleware.After)
128	if err != nil {
129		return err
130	}
131	if err = addSetLoggerMiddleware(stack, options); err != nil {
132		return err
133	}
134	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
135		return err
136	}
137	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
138		return err
139	}
140	if err = addResolveEndpointMiddleware(stack, options); err != nil {
141		return err
142	}
143	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
144		return err
145	}
146	if err = addRetryMiddlewares(stack, options); err != nil {
147		return err
148	}
149	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
150		return err
151	}
152	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
153		return err
154	}
155	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
156		return err
157	}
158	if err = addClientUserAgent(stack); err != nil {
159		return err
160	}
161	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
162		return err
163	}
164	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
165		return err
166	}
167	if err = addOpCreateDeploymentStrategyValidationMiddleware(stack); err != nil {
168		return err
169	}
170	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDeploymentStrategy(options.Region), middleware.Before); err != nil {
171		return err
172	}
173	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
174		return err
175	}
176	if err = addResponseErrorMiddleware(stack); err != nil {
177		return err
178	}
179	if err = addRequestResponseLogging(stack, options); err != nil {
180		return err
181	}
182	return nil
183}
184
185func newServiceMetadataMiddleware_opCreateDeploymentStrategy(region string) *awsmiddleware.RegisterServiceMetadata {
186	return &awsmiddleware.RegisterServiceMetadata{
187		Region:        region,
188		ServiceID:     ServiceID,
189		SigningName:   "appconfig",
190		OperationName: "CreateDeploymentStrategy",
191	}
192}
193