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// Amazon Relational Database Service (Amazon RDS) supports importing MySQL 15// databases by using backup files. You can create a backup of your on-premises 16// database, store it on Amazon Simple Storage Service (Amazon S3), and then 17// restore the backup file onto a new Amazon RDS DB instance running MySQL. For 18// more information, see Importing Data into an Amazon RDS MySQL DB Instance 19// (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Importing.html) 20// in the Amazon RDS User Guide. 21func (c *Client) RestoreDBInstanceFromS3(ctx context.Context, params *RestoreDBInstanceFromS3Input, optFns ...func(*Options)) (*RestoreDBInstanceFromS3Output, error) { 22 if params == nil { 23 params = &RestoreDBInstanceFromS3Input{} 24 } 25 26 result, metadata, err := c.invokeOperation(ctx, "RestoreDBInstanceFromS3", params, optFns, addOperationRestoreDBInstanceFromS3Middlewares) 27 if err != nil { 28 return nil, err 29 } 30 31 out := result.(*RestoreDBInstanceFromS3Output) 32 out.ResultMetadata = metadata 33 return out, nil 34} 35 36type RestoreDBInstanceFromS3Input struct { 37 38 // The compute and memory capacity of the DB instance, for example, db.m4.large. 39 // Not all DB instance classes are available in all AWS Regions, or for all 40 // database engines. For the full list of DB instance classes, and availability for 41 // your engine, see DB Instance Class 42 // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html) 43 // in the Amazon RDS User Guide. Importing from Amazon S3 isn't supported on the 44 // db.t2.micro DB instance class. 45 // 46 // This member is required. 47 DBInstanceClass *string 48 49 // The DB instance identifier. This parameter is stored as a lowercase string. 50 // Constraints: 51 // 52 // * Must contain from 1 to 63 letters, numbers, or hyphens. 53 // 54 // * First 55 // character must be a letter. 56 // 57 // * Can't end with a hyphen or contain two 58 // consecutive hyphens. 59 // 60 // Example: mydbinstance 61 // 62 // This member is required. 63 DBInstanceIdentifier *string 64 65 // The name of the database engine to be used for this instance. Valid Values: 66 // mysql 67 // 68 // This member is required. 69 Engine *string 70 71 // The name of your Amazon S3 bucket that contains your database backup file. 72 // 73 // This member is required. 74 S3BucketName *string 75 76 // An AWS Identity and Access Management (IAM) role to allow Amazon RDS to access 77 // your Amazon S3 bucket. 78 // 79 // This member is required. 80 S3IngestionRoleArn *string 81 82 // The name of the engine of your source database. Valid Values: mysql 83 // 84 // This member is required. 85 SourceEngine *string 86 87 // The version of the database that the backup files were created from. MySQL 88 // versions 5.6 and 5.7 are supported. Example: 5.6.40 89 // 90 // This member is required. 91 SourceEngineVersion *string 92 93 // The amount of storage (in gigabytes) to allocate initially for the DB instance. 94 // Follow the allocation rules specified in CreateDBInstance. Be sure to allocate 95 // enough memory for your new DB instance so that the restore operation can 96 // succeed. You can also allocate additional memory for future growth. 97 AllocatedStorage *int32 98 99 // A value that indicates whether minor engine upgrades are applied automatically 100 // to the DB instance during the maintenance window. By default, minor engine 101 // upgrades are not applied automatically. 102 AutoMinorVersionUpgrade *bool 103 104 // The Availability Zone that the DB instance is created in. For information about 105 // AWS Regions and Availability Zones, see Regions and Availability Zones 106 // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html) 107 // in the Amazon RDS User Guide. Default: A random, system-chosen Availability Zone 108 // in the endpoint's AWS Region. Example: us-east-1d Constraint: The 109 // AvailabilityZone parameter can't be specified if the DB instance is a Multi-AZ 110 // deployment. The specified Availability Zone must be in the same AWS Region as 111 // the current endpoint. 112 AvailabilityZone *string 113 114 // The number of days for which automated backups are retained. Setting this 115 // parameter to a positive number enables backups. For more information, see 116 // CreateDBInstance. 117 BackupRetentionPeriod *int32 118 119 // A value that indicates whether to copy all tags from the DB instance to 120 // snapshots of the DB instance. By default, tags are not copied. 121 CopyTagsToSnapshot *bool 122 123 // The name of the database to create when the DB instance is created. Follow the 124 // naming rules specified in CreateDBInstance. 125 DBName *string 126 127 // The name of the DB parameter group to associate with this DB instance. If you do 128 // not specify a value for DBParameterGroupName, then the default DBParameterGroup 129 // for the specified DB engine is used. 130 DBParameterGroupName *string 131 132 // A list of DB security groups to associate with this DB instance. Default: The 133 // default DB security group for the database engine. 134 DBSecurityGroups []string 135 136 // A DB subnet group to associate with this DB instance. 137 DBSubnetGroupName *string 138 139 // A value that indicates whether the DB instance has deletion protection enabled. 140 // The database can't be deleted when deletion protection is enabled. By default, 141 // deletion protection is disabled. For more information, see Deleting a DB 142 // Instance 143 // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DeleteInstance.html). 144 DeletionProtection *bool 145 146 // The list of logs that the restored DB instance is to export to CloudWatch Logs. 147 // The values in the list depend on the DB engine being used. For more information, 148 // see Publishing Database Logs to Amazon CloudWatch Logs 149 // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch) 150 // in the Amazon RDS User Guide. 151 EnableCloudwatchLogsExports []string 152 153 // A value that indicates whether to enable mapping of AWS Identity and Access 154 // Management (IAM) accounts to database accounts. By default, mapping is disabled. 155 // For more information about IAM database authentication, see IAM Database 156 // Authentication for MySQL and PostgreSQL 157 // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html) 158 // in the Amazon RDS User Guide. 159 EnableIAMDatabaseAuthentication *bool 160 161 // A value that indicates whether to enable Performance Insights for the DB 162 // instance. For more information, see Using Amazon Performance Insights 163 // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html) 164 // in the Amazon Relational Database Service User Guide. 165 EnablePerformanceInsights *bool 166 167 // The version number of the database engine to use. Choose the latest minor 168 // version of your database engine. For information about engine versions, see 169 // CreateDBInstance, or call DescribeDBEngineVersions. 170 EngineVersion *string 171 172 // The amount of Provisioned IOPS (input/output operations per second) to allocate 173 // initially for the DB instance. For information about valid Iops values, see 174 // Amazon RDS Provisioned IOPS Storage to Improve Performance 175 // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS) 176 // in the Amazon RDS User Guide. 177 Iops *int32 178 179 // The AWS KMS key identifier for an encrypted DB instance. The AWS KMS key 180 // identifier is the key ARN, key ID, alias ARN, or alias name for the AWS KMS 181 // customer master key (CMK). To use a CMK in a different AWS account, specify the 182 // key ARN or alias ARN. If the StorageEncrypted parameter is enabled, and you do 183 // not specify a value for the KmsKeyId parameter, then Amazon RDS will use your 184 // default CMK. There is a default CMK for your AWS account. Your AWS account has a 185 // different default CMK for each AWS Region. 186 KmsKeyId *string 187 188 // The license model for this DB instance. Use general-public-license. 189 LicenseModel *string 190 191 // The password for the master user. The password can include any printable ASCII 192 // character except "/", """, or "@". Constraints: Must contain from 8 to 41 193 // characters. 194 MasterUserPassword *string 195 196 // The name for the master user. Constraints: 197 // 198 // * Must be 1 to 16 letters or 199 // numbers. 200 // 201 // * First character must be a letter. 202 // 203 // * Can't be a reserved word for 204 // the chosen database engine. 205 MasterUsername *string 206 207 // The upper limit to which Amazon RDS can automatically scale the storage of the 208 // DB instance. For more information about this setting, including limitations that 209 // apply to it, see Managing capacity automatically with Amazon RDS storage 210 // autoscaling 211 // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.Autoscaling) 212 // in the Amazon RDS User Guide. 213 MaxAllocatedStorage *int32 214 215 // The interval, in seconds, between points when Enhanced Monitoring metrics are 216 // collected for the DB instance. To disable collecting Enhanced Monitoring 217 // metrics, specify 0. If MonitoringRoleArn is specified, then you must also set 218 // MonitoringInterval to a value other than 0. Valid Values: 0, 1, 5, 10, 15, 30, 219 // 60 Default: 0 220 MonitoringInterval *int32 221 222 // The ARN for the IAM role that permits RDS to send enhanced monitoring metrics to 223 // Amazon CloudWatch Logs. For example, arn:aws:iam:123456789012:role/emaccess. For 224 // information on creating a monitoring role, see Setting Up and Enabling Enhanced 225 // Monitoring 226 // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.OS.html#USER_Monitoring.OS.Enabling) 227 // in the Amazon RDS User Guide. If MonitoringInterval is set to a value other than 228 // 0, then you must supply a MonitoringRoleArn value. 229 MonitoringRoleArn *string 230 231 // A value that indicates whether the DB instance is a Multi-AZ deployment. If the 232 // DB instance is a Multi-AZ deployment, you can't set the AvailabilityZone 233 // parameter. 234 MultiAZ *bool 235 236 // The name of the option group to associate with this DB instance. If this 237 // argument is omitted, the default option group for the specified engine is used. 238 OptionGroupName *string 239 240 // The AWS KMS key identifier for encryption of Performance Insights data. The AWS 241 // KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the AWS 242 // KMS customer master key (CMK). If you do not specify a value for 243 // PerformanceInsightsKMSKeyId, then Amazon RDS uses your default CMK. There is a 244 // default CMK for your AWS account. Your AWS account has a different default CMK 245 // for each AWS Region. 246 PerformanceInsightsKMSKeyId *string 247 248 // The amount of time, in days, to retain Performance Insights data. Valid values 249 // are 7 or 731 (2 years). 250 PerformanceInsightsRetentionPeriod *int32 251 252 // The port number on which the database accepts connections. Type: Integer Valid 253 // Values: 1150-65535 Default: 3306 254 Port *int32 255 256 // The time range each day during which automated backups are created if automated 257 // backups are enabled. For more information, see The Backup Window 258 // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow) 259 // in the Amazon RDS User Guide. Constraints: 260 // 261 // * Must be in the format 262 // hh24:mi-hh24:mi. 263 // 264 // * Must be in Universal Coordinated Time (UTC). 265 // 266 // * Must not 267 // conflict with the preferred maintenance window. 268 // 269 // * Must be at least 30 minutes. 270 PreferredBackupWindow *string 271 272 // The time range each week during which system maintenance can occur, in Universal 273 // Coordinated Time (UTC). For more information, see Amazon RDS Maintenance Window 274 // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance) 275 // in the Amazon RDS User Guide. Constraints: 276 // 277 // * Must be in the format 278 // ddd:hh24:mi-ddd:hh24:mi. 279 // 280 // * Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun. 281 // 282 // * 283 // Must be in Universal Coordinated Time (UTC). 284 // 285 // * Must not conflict with the 286 // preferred backup window. 287 // 288 // * Must be at least 30 minutes. 289 PreferredMaintenanceWindow *string 290 291 // The number of CPU cores and the number of threads per core for the DB instance 292 // class of the DB instance. 293 ProcessorFeatures []types.ProcessorFeature 294 295 // A value that indicates whether the DB instance is publicly accessible. When the 296 // DB instance is publicly accessible, its DNS endpoint resolves to the private IP 297 // address from within the DB instance's VPC, and to the public IP address from 298 // outside of the DB instance's VPC. Access to the DB instance is ultimately 299 // controlled by the security group it uses, and that public access is not 300 // permitted if the security group assigned to the DB instance doesn't permit it. 301 // When the DB instance isn't publicly accessible, it is an internal DB instance 302 // with a DNS name that resolves to a private IP address. For more information, see 303 // CreateDBInstance. 304 PubliclyAccessible *bool 305 306 // The prefix of your Amazon S3 bucket. 307 S3Prefix *string 308 309 // A value that indicates whether the new DB instance is encrypted or not. 310 StorageEncrypted *bool 311 312 // Specifies the storage type to be associated with the DB instance. Valid values: 313 // standard | gp2 | io1 If you specify io1, you must also include a value for the 314 // Iops parameter. Default: io1 if the Iops parameter is specified; otherwise gp2 315 StorageType *string 316 317 // A list of tags to associate with this DB instance. For more information, see 318 // Tagging Amazon RDS Resources 319 // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html) in 320 // the Amazon RDS User Guide. 321 Tags []types.Tag 322 323 // A value that indicates whether the DB instance class of the DB instance uses its 324 // default processor features. 325 UseDefaultProcessorFeatures *bool 326 327 // A list of VPC security groups to associate with this DB instance. 328 VpcSecurityGroupIds []string 329} 330 331type RestoreDBInstanceFromS3Output struct { 332 333 // Contains the details of an Amazon RDS DB instance. This data type is used as a 334 // response element in the DescribeDBInstances action. 335 DBInstance *types.DBInstance 336 337 // Metadata pertaining to the operation's result. 338 ResultMetadata middleware.Metadata 339} 340 341func addOperationRestoreDBInstanceFromS3Middlewares(stack *middleware.Stack, options Options) (err error) { 342 err = stack.Serialize.Add(&awsAwsquery_serializeOpRestoreDBInstanceFromS3{}, middleware.After) 343 if err != nil { 344 return err 345 } 346 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpRestoreDBInstanceFromS3{}, middleware.After) 347 if err != nil { 348 return err 349 } 350 if err = addSetLoggerMiddleware(stack, options); err != nil { 351 return err 352 } 353 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 354 return err 355 } 356 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 357 return err 358 } 359 if err = addResolveEndpointMiddleware(stack, options); err != nil { 360 return err 361 } 362 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 363 return err 364 } 365 if err = addRetryMiddlewares(stack, options); err != nil { 366 return err 367 } 368 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 369 return err 370 } 371 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 372 return err 373 } 374 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 375 return err 376 } 377 if err = addClientUserAgent(stack); err != nil { 378 return err 379 } 380 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 381 return err 382 } 383 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 384 return err 385 } 386 if err = addOpRestoreDBInstanceFromS3ValidationMiddleware(stack); err != nil { 387 return err 388 } 389 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRestoreDBInstanceFromS3(options.Region), middleware.Before); err != nil { 390 return err 391 } 392 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 393 return err 394 } 395 if err = addResponseErrorMiddleware(stack); err != nil { 396 return err 397 } 398 if err = addRequestResponseLogging(stack, options); err != nil { 399 return err 400 } 401 return nil 402} 403 404func newServiceMetadataMiddleware_opRestoreDBInstanceFromS3(region string) *awsmiddleware.RegisterServiceMetadata { 405 return &awsmiddleware.RegisterServiceMetadata{ 406 Region: region, 407 ServiceID: ServiceID, 408 SigningName: "rds", 409 OperationName: "RestoreDBInstanceFromS3", 410 } 411} 412