1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package rds
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/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11	"time"
12)
13
14// Backtracks a DB cluster to a specific time, without creating a new DB cluster.
15// For more information on backtracking, see  Backtracking an Aurora DB Cluster
16// (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Managing.Backtrack.html)
17// in the Amazon Aurora User Guide. This action only applies to Aurora MySQL DB
18// clusters.
19func (c *Client) BacktrackDBCluster(ctx context.Context, params *BacktrackDBClusterInput, optFns ...func(*Options)) (*BacktrackDBClusterOutput, error) {
20	if params == nil {
21		params = &BacktrackDBClusterInput{}
22	}
23
24	result, metadata, err := c.invokeOperation(ctx, "BacktrackDBCluster", params, optFns, addOperationBacktrackDBClusterMiddlewares)
25	if err != nil {
26		return nil, err
27	}
28
29	out := result.(*BacktrackDBClusterOutput)
30	out.ResultMetadata = metadata
31	return out, nil
32}
33
34//
35type BacktrackDBClusterInput struct {
36
37	// The timestamp of the time to backtrack the DB cluster to, specified in ISO 8601
38	// format. For more information about ISO 8601, see the ISO8601 Wikipedia page.
39	// (http://en.wikipedia.org/wiki/ISO_8601) If the specified time isn't a consistent
40	// time for the DB cluster, Aurora automatically chooses the nearest possible
41	// consistent time for the DB cluster. Constraints:
42	//
43	// * Must contain a valid ISO
44	// 8601 timestamp.
45	//
46	// * Can't contain a timestamp set in the future.
47	//
48	// Example:
49	// 2017-07-08T18:00Z
50	//
51	// This member is required.
52	BacktrackTo *time.Time
53
54	// The DB cluster identifier of the DB cluster to be backtracked. This parameter is
55	// stored as a lowercase string. Constraints:
56	//
57	// * Must contain from 1 to 63
58	// alphanumeric characters or hyphens.
59	//
60	// * First character must be a letter.
61	//
62	// *
63	// Can't end with a hyphen or contain two consecutive hyphens.
64	//
65	// Example:
66	// my-cluster1
67	//
68	// This member is required.
69	DBClusterIdentifier *string
70
71	// A value that indicates whether to force the DB cluster to backtrack when binary
72	// logging is enabled. Otherwise, an error occurs when binary logging is enabled.
73	Force *bool
74
75	// A value that indicates whether to backtrack the DB cluster to the earliest
76	// possible backtrack time when BacktrackTo is set to a timestamp earlier than the
77	// earliest backtrack time. When this parameter is disabled and BacktrackTo is set
78	// to a timestamp earlier than the earliest backtrack time, an error occurs.
79	UseEarliestTimeOnPointInTimeUnavailable *bool
80}
81
82// This data type is used as a response element in the DescribeDBClusterBacktracks
83// action.
84type BacktrackDBClusterOutput struct {
85
86	// Contains the backtrack identifier.
87	BacktrackIdentifier *string
88
89	// The timestamp of the time at which the backtrack was requested.
90	BacktrackRequestCreationTime *time.Time
91
92	// The timestamp of the time to which the DB cluster was backtracked.
93	BacktrackTo *time.Time
94
95	// The timestamp of the time from which the DB cluster was backtracked.
96	BacktrackedFrom *time.Time
97
98	// Contains a user-supplied DB cluster identifier. This identifier is the unique
99	// key that identifies a DB cluster.
100	DBClusterIdentifier *string
101
102	// The status of the backtrack. This property returns one of the following
103	// values:
104	//
105	// * applying - The backtrack is currently being applied to or rolled back
106	// from the DB cluster.
107	//
108	// * completed - The backtrack has successfully been applied
109	// to or rolled back from the DB cluster.
110	//
111	// * failed - An error occurred while the
112	// backtrack was applied to or rolled back from the DB cluster.
113	//
114	// * pending - The
115	// backtrack is currently pending application to or rollback from the DB cluster.
116	Status *string
117
118	// Metadata pertaining to the operation's result.
119	ResultMetadata middleware.Metadata
120}
121
122func addOperationBacktrackDBClusterMiddlewares(stack *middleware.Stack, options Options) (err error) {
123	err = stack.Serialize.Add(&awsAwsquery_serializeOpBacktrackDBCluster{}, middleware.After)
124	if err != nil {
125		return err
126	}
127	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpBacktrackDBCluster{}, 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 = addOpBacktrackDBClusterValidationMiddleware(stack); err != nil {
168		return err
169	}
170	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBacktrackDBCluster(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_opBacktrackDBCluster(region string) *awsmiddleware.RegisterServiceMetadata {
186	return &awsmiddleware.RegisterServiceMetadata{
187		Region:        region,
188		ServiceID:     ServiceID,
189		SigningName:   "rds",
190		OperationName: "BacktrackDBCluster",
191	}
192}
193