1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package cloudformation
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/cloudformation/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12	"time"
13)
14
15// Returns information about a stack drift detection operation. A stack drift
16// detection operation detects whether a stack's actual configuration differs, or
17// has drifted, from it's expected configuration, as defined in the stack template
18// and any values specified as template parameters. A stack is considered to have
19// drifted if one or more of its resources have drifted. For more information on
20// stack and resource drift, see Detecting Unregulated Configuration Changes to
21// Stacks and Resources
22// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html).
23// Use DetectStackDrift to initiate a stack drift detection operation.
24// DetectStackDrift returns a StackDriftDetectionId you can use to monitor the
25// progress of the operation using DescribeStackDriftDetectionStatus. Once the
26// drift detection operation has completed, use DescribeStackResourceDrifts to
27// return drift information about the stack and its resources.
28func (c *Client) DescribeStackDriftDetectionStatus(ctx context.Context, params *DescribeStackDriftDetectionStatusInput, optFns ...func(*Options)) (*DescribeStackDriftDetectionStatusOutput, error) {
29	if params == nil {
30		params = &DescribeStackDriftDetectionStatusInput{}
31	}
32
33	result, metadata, err := c.invokeOperation(ctx, "DescribeStackDriftDetectionStatus", params, optFns, addOperationDescribeStackDriftDetectionStatusMiddlewares)
34	if err != nil {
35		return nil, err
36	}
37
38	out := result.(*DescribeStackDriftDetectionStatusOutput)
39	out.ResultMetadata = metadata
40	return out, nil
41}
42
43type DescribeStackDriftDetectionStatusInput struct {
44
45	// The ID of the drift detection results of this operation. AWS CloudFormation
46	// generates new results, with a new drift detection ID, each time this operation
47	// is run. However, the number of drift results AWS CloudFormation retains for any
48	// given stack, and for how long, may vary.
49	//
50	// This member is required.
51	StackDriftDetectionId *string
52}
53
54type DescribeStackDriftDetectionStatusOutput struct {
55
56	// The status of the stack drift detection operation.
57	//
58	// * DETECTION_COMPLETE: The
59	// stack drift detection operation has successfully completed for all resources in
60	// the stack that support drift detection. (Resources that do not currently support
61	// stack detection remain unchecked.) If you specified logical resource IDs for AWS
62	// CloudFormation to use as a filter for the stack drift detection operation, only
63	// the resources with those logical IDs are checked for drift.
64	//
65	// * DETECTION_FAILED:
66	// The stack drift detection operation has failed for at least one resource in the
67	// stack. Results will be available for resources on which AWS CloudFormation
68	// successfully completed drift detection.
69	//
70	// * DETECTION_IN_PROGRESS: The stack
71	// drift detection operation is currently in progress.
72	//
73	// This member is required.
74	DetectionStatus types.StackDriftDetectionStatus
75
76	// The ID of the drift detection results of this operation. AWS CloudFormation
77	// generates new results, with a new drift detection ID, each time this operation
78	// is run. However, the number of reports AWS CloudFormation retains for any given
79	// stack, and for how long, may vary.
80	//
81	// This member is required.
82	StackDriftDetectionId *string
83
84	// The ID of the stack.
85	//
86	// This member is required.
87	StackId *string
88
89	// Time at which the stack drift detection operation was initiated.
90	//
91	// This member is required.
92	Timestamp *time.Time
93
94	// The reason the stack drift detection operation has its current status.
95	DetectionStatusReason *string
96
97	// Total number of stack resources that have drifted. This is NULL until the drift
98	// detection operation reaches a status of DETECTION_COMPLETE. This value will be 0
99	// for stacks whose drift status is IN_SYNC.
100	DriftedStackResourceCount *int32
101
102	// Status of the stack's actual configuration compared to its expected
103	// configuration.
104	//
105	// * DRIFTED: The stack differs from its expected template
106	// configuration. A stack is considered to have drifted if one or more of its
107	// resources have drifted.
108	//
109	// * NOT_CHECKED: AWS CloudFormation has not checked if
110	// the stack differs from its expected template configuration.
111	//
112	// * IN_SYNC: The
113	// stack's actual configuration matches its expected template configuration.
114	//
115	// *
116	// UNKNOWN: This value is reserved for future use.
117	StackDriftStatus types.StackDriftStatus
118
119	// Metadata pertaining to the operation's result.
120	ResultMetadata middleware.Metadata
121}
122
123func addOperationDescribeStackDriftDetectionStatusMiddlewares(stack *middleware.Stack, options Options) (err error) {
124	err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeStackDriftDetectionStatus{}, middleware.After)
125	if err != nil {
126		return err
127	}
128	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeStackDriftDetectionStatus{}, middleware.After)
129	if err != nil {
130		return err
131	}
132	if err = addSetLoggerMiddleware(stack, options); err != nil {
133		return err
134	}
135	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
136		return err
137	}
138	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
139		return err
140	}
141	if err = addResolveEndpointMiddleware(stack, options); err != nil {
142		return err
143	}
144	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
145		return err
146	}
147	if err = addRetryMiddlewares(stack, options); err != nil {
148		return err
149	}
150	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
151		return err
152	}
153	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
154		return err
155	}
156	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
157		return err
158	}
159	if err = addClientUserAgent(stack); err != nil {
160		return err
161	}
162	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
163		return err
164	}
165	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
166		return err
167	}
168	if err = addOpDescribeStackDriftDetectionStatusValidationMiddleware(stack); err != nil {
169		return err
170	}
171	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeStackDriftDetectionStatus(options.Region), middleware.Before); err != nil {
172		return err
173	}
174	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
175		return err
176	}
177	if err = addResponseErrorMiddleware(stack); err != nil {
178		return err
179	}
180	if err = addRequestResponseLogging(stack, options); err != nil {
181		return err
182	}
183	return nil
184}
185
186func newServiceMetadataMiddleware_opDescribeStackDriftDetectionStatus(region string) *awsmiddleware.RegisterServiceMetadata {
187	return &awsmiddleware.RegisterServiceMetadata{
188		Region:        region,
189		ServiceID:     ServiceID,
190		SigningName:   "cloudformation",
191		OperationName: "DescribeStackDriftDetectionStatus",
192	}
193}
194