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/aws-sdk-go-v2/service/rds/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates an Amazon Aurora DB cluster from MySQL data stored in an Amazon S3
15// bucket. Amazon RDS must be authorized to access the Amazon S3 bucket and the
16// data must be created using the Percona XtraBackup utility as described in
17// Migrating Data from MySQL by Using an Amazon S3 Bucket
18// (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Migrating.ExtMySQL.html#AuroraMySQL.Migrating.ExtMySQL.S3)
19// in the Amazon Aurora User Guide. This action only restores the DB cluster, not
20// the DB instances for that DB cluster. You must invoke the CreateDBInstance
21// action to create DB instances for the restored DB cluster, specifying the
22// identifier of the restored DB cluster in DBClusterIdentifier. You can create DB
23// instances only after the RestoreDBClusterFromS3 action has completed and the DB
24// cluster is available. For more information on Amazon Aurora, see  What Is Amazon
25// Aurora?
26// (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
27// in the Amazon Aurora User Guide. This action only applies to Aurora DB clusters.
28// The source DB engine must be MySQL.
29func (c *Client) RestoreDBClusterFromS3(ctx context.Context, params *RestoreDBClusterFromS3Input, optFns ...func(*Options)) (*RestoreDBClusterFromS3Output, error) {
30	if params == nil {
31		params = &RestoreDBClusterFromS3Input{}
32	}
33
34	result, metadata, err := c.invokeOperation(ctx, "RestoreDBClusterFromS3", params, optFns, addOperationRestoreDBClusterFromS3Middlewares)
35	if err != nil {
36		return nil, err
37	}
38
39	out := result.(*RestoreDBClusterFromS3Output)
40	out.ResultMetadata = metadata
41	return out, nil
42}
43
44type RestoreDBClusterFromS3Input struct {
45
46	// The name of the DB cluster to create from the source data in the Amazon S3
47	// bucket. This parameter isn't case-sensitive. Constraints:
48	//
49	// * Must contain from 1
50	// to 63 letters, numbers, or hyphens.
51	//
52	// * First character must be a letter.
53	//
54	// *
55	// Can't end with a hyphen or contain two consecutive hyphens.
56	//
57	// Example:
58	// my-cluster1
59	//
60	// This member is required.
61	DBClusterIdentifier *string
62
63	// The name of the database engine to be used for this DB cluster. Valid Values:
64	// aurora (for MySQL 5.6-compatible Aurora), aurora-mysql (for MySQL 5.7-compatible
65	// Aurora), and aurora-postgresql
66	//
67	// This member is required.
68	Engine *string
69
70	// The password for the master database user. This password can contain any
71	// printable ASCII character except "/", """, or "@". Constraints: Must contain
72	// from 8 to 41 characters.
73	//
74	// This member is required.
75	MasterUserPassword *string
76
77	// The name of the master user for the restored DB cluster. Constraints:
78	//
79	// * Must be
80	// 1 to 16 letters or numbers.
81	//
82	// * First character must be a letter.
83	//
84	// * Can't be a
85	// reserved word for the chosen database engine.
86	//
87	// This member is required.
88	MasterUsername *string
89
90	// The name of the Amazon S3 bucket that contains the data used to create the
91	// Amazon Aurora DB cluster.
92	//
93	// This member is required.
94	S3BucketName *string
95
96	// The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM)
97	// role that authorizes Amazon RDS to access the Amazon S3 bucket on your behalf.
98	//
99	// This member is required.
100	S3IngestionRoleArn *string
101
102	// The identifier for the database engine that was backed up to create the files
103	// stored in the Amazon S3 bucket. Valid values: mysql
104	//
105	// This member is required.
106	SourceEngine *string
107
108	// The version of the database that the backup files were created from. MySQL
109	// versions 5.5, 5.6, and 5.7 are supported. Example: 5.6.40, 5.7.28
110	//
111	// This member is required.
112	SourceEngineVersion *string
113
114	// A list of Availability Zones (AZs) where instances in the restored DB cluster
115	// can be created.
116	AvailabilityZones []string
117
118	// The target backtrack window, in seconds. To disable backtracking, set this value
119	// to 0. Currently, Backtrack is only supported for Aurora MySQL DB clusters.
120	// Default: 0 Constraints:
121	//
122	// * If specified, this value must be set to a number from
123	// 0 to 259,200 (72 hours).
124	BacktrackWindow *int64
125
126	// The number of days for which automated backups of the restored DB cluster are
127	// retained. You must specify a minimum value of 1. Default: 1 Constraints:
128	//
129	// * Must
130	// be a value from 1 to 35
131	BackupRetentionPeriod *int32
132
133	// A value that indicates that the restored DB cluster should be associated with
134	// the specified CharacterSet.
135	CharacterSetName *string
136
137	// A value that indicates whether to copy all tags from the restored DB cluster to
138	// snapshots of the restored DB cluster. The default is not to copy them.
139	CopyTagsToSnapshot *bool
140
141	// The name of the DB cluster parameter group to associate with the restored DB
142	// cluster. If this argument is omitted, default.aurora5.6 is used. Constraints:
143	//
144	// *
145	// If supplied, must match the name of an existing DBClusterParameterGroup.
146	DBClusterParameterGroupName *string
147
148	// A DB subnet group to associate with the restored DB cluster. Constraints: If
149	// supplied, must match the name of an existing DBSubnetGroup. Example:
150	// mySubnetgroup
151	DBSubnetGroupName *string
152
153	// The database name for the restored DB cluster.
154	DatabaseName *string
155
156	// A value that indicates whether the DB cluster has deletion protection enabled.
157	// The database can't be deleted when deletion protection is enabled. By default,
158	// deletion protection is disabled.
159	DeletionProtection *bool
160
161	// Specify the Active Directory directory ID to restore the DB cluster in. The
162	// domain must be created prior to this operation. For Amazon Aurora DB clusters,
163	// Amazon RDS can use Kerberos Authentication to authenticate users that connect to
164	// the DB cluster. For more information, see Kerberos Authentication
165	// (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/kerberos-authentication.html)
166	// in the Amazon Aurora User Guide.
167	Domain *string
168
169	// Specify the name of the IAM role to be used when making API calls to the
170	// Directory Service.
171	DomainIAMRoleName *string
172
173	// The list of logs that the restored DB cluster is to export to CloudWatch Logs.
174	// The values in the list depend on the DB engine being used. For more information,
175	// see Publishing Database Logs to Amazon CloudWatch Logs
176	// (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch)
177	// in the Amazon Aurora User Guide.
178	EnableCloudwatchLogsExports []string
179
180	// A value that indicates whether to enable mapping of AWS Identity and Access
181	// Management (IAM) accounts to database accounts. By default, mapping is disabled.
182	// For more information, see  IAM Database Authentication
183	// (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.IAMDBAuth.html)
184	// in the Amazon Aurora User Guide.
185	EnableIAMDatabaseAuthentication *bool
186
187	// The version number of the database engine to use. To list all of the available
188	// engine versions for aurora (for MySQL 5.6-compatible Aurora), use the following
189	// command: aws rds describe-db-engine-versions --engine aurora --query
190	// "DBEngineVersions[].EngineVersion" To list all of the available engine versions
191	// for aurora-mysql (for MySQL 5.7-compatible Aurora), use the following command:
192	// aws rds describe-db-engine-versions --engine aurora-mysql --query
193	// "DBEngineVersions[].EngineVersion" To list all of the available engine versions
194	// for aurora-postgresql, use the following command: aws rds
195	// describe-db-engine-versions --engine aurora-postgresql --query
196	// "DBEngineVersions[].EngineVersion" Aurora MySQL Example: 5.6.10a,
197	// 5.6.mysql_aurora.1.19.2, 5.7.12, 5.7.mysql_aurora.2.04.5 Aurora PostgreSQL
198	// Example: 9.6.3, 10.7
199	EngineVersion *string
200
201	// The AWS KMS key identifier for an encrypted DB cluster. The AWS KMS key
202	// identifier is the key ARN, key ID, alias ARN, or alias name for the AWS KMS
203	// customer master key (CMK). To use a CMK in a different AWS account, specify the
204	// key ARN or alias ARN. If the StorageEncrypted parameter is enabled, and you do
205	// not specify a value for the KmsKeyId parameter, then Amazon RDS will use your
206	// default CMK. There is a default CMK for your AWS account. Your AWS account has a
207	// different default CMK for each AWS Region.
208	KmsKeyId *string
209
210	// A value that indicates that the restored DB cluster should be associated with
211	// the specified option group. Permanent options can't be removed from an option
212	// group. An option group can't be removed from a DB cluster once it is associated
213	// with a DB cluster.
214	OptionGroupName *string
215
216	// The port number on which the instances in the restored DB cluster accept
217	// connections. Default: 3306
218	Port *int32
219
220	// The daily time range during which automated backups are created if automated
221	// backups are enabled using the BackupRetentionPeriod parameter. The default is a
222	// 30-minute window selected at random from an 8-hour block of time for each AWS
223	// Region. To see the time blocks available, see  Adjusting the Preferred
224	// Maintenance Window
225	// (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Maintenance.html#AdjustingTheMaintenanceWindow.Aurora)
226	// in the Amazon Aurora User Guide. Constraints:
227	//
228	// * Must be in the format
229	// hh24:mi-hh24:mi.
230	//
231	// * Must be in Universal Coordinated Time (UTC).
232	//
233	// * Must not
234	// conflict with the preferred maintenance window.
235	//
236	// * Must be at least 30 minutes.
237	PreferredBackupWindow *string
238
239	// The weekly time range during which system maintenance can occur, in Universal
240	// Coordinated Time (UTC). Format: ddd:hh24:mi-ddd:hh24:mi The default is a
241	// 30-minute window selected at random from an 8-hour block of time for each AWS
242	// Region, occurring on a random day of the week. To see the time blocks available,
243	// see  Adjusting the Preferred Maintenance Window
244	// (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Maintenance.html#AdjustingTheMaintenanceWindow.Aurora)
245	// in the Amazon Aurora User Guide. Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun.
246	// Constraints: Minimum 30-minute window.
247	PreferredMaintenanceWindow *string
248
249	// The prefix for all of the file names that contain the data used to create the
250	// Amazon Aurora DB cluster. If you do not specify a SourceS3Prefix value, then the
251	// Amazon Aurora DB cluster is created by using all of the files in the Amazon S3
252	// bucket.
253	S3Prefix *string
254
255	// A value that indicates whether the restored DB cluster is encrypted.
256	StorageEncrypted *bool
257
258	// A list of tags. For more information, see Tagging Amazon RDS Resources
259	// (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html) in
260	// the Amazon RDS User Guide.
261	Tags []types.Tag
262
263	// A list of EC2 VPC security groups to associate with the restored DB cluster.
264	VpcSecurityGroupIds []string
265}
266
267type RestoreDBClusterFromS3Output struct {
268
269	// Contains the details of an Amazon Aurora DB cluster. This data type is used as a
270	// response element in the DescribeDBClusters, StopDBCluster, and StartDBCluster
271	// actions.
272	DBCluster *types.DBCluster
273
274	// Metadata pertaining to the operation's result.
275	ResultMetadata middleware.Metadata
276}
277
278func addOperationRestoreDBClusterFromS3Middlewares(stack *middleware.Stack, options Options) (err error) {
279	err = stack.Serialize.Add(&awsAwsquery_serializeOpRestoreDBClusterFromS3{}, middleware.After)
280	if err != nil {
281		return err
282	}
283	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpRestoreDBClusterFromS3{}, middleware.After)
284	if err != nil {
285		return err
286	}
287	if err = addSetLoggerMiddleware(stack, options); err != nil {
288		return err
289	}
290	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
291		return err
292	}
293	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
294		return err
295	}
296	if err = addResolveEndpointMiddleware(stack, options); err != nil {
297		return err
298	}
299	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
300		return err
301	}
302	if err = addRetryMiddlewares(stack, options); err != nil {
303		return err
304	}
305	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
306		return err
307	}
308	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
309		return err
310	}
311	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
312		return err
313	}
314	if err = addClientUserAgent(stack); err != nil {
315		return err
316	}
317	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
318		return err
319	}
320	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
321		return err
322	}
323	if err = addOpRestoreDBClusterFromS3ValidationMiddleware(stack); err != nil {
324		return err
325	}
326	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRestoreDBClusterFromS3(options.Region), middleware.Before); err != nil {
327		return err
328	}
329	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
330		return err
331	}
332	if err = addResponseErrorMiddleware(stack); err != nil {
333		return err
334	}
335	if err = addRequestResponseLogging(stack, options); err != nil {
336		return err
337	}
338	return nil
339}
340
341func newServiceMetadataMiddleware_opRestoreDBClusterFromS3(region string) *awsmiddleware.RegisterServiceMetadata {
342	return &awsmiddleware.RegisterServiceMetadata{
343		Region:        region,
344		ServiceID:     ServiceID,
345		SigningName:   "rds",
346		OperationName: "RestoreDBClusterFromS3",
347	}
348}
349