/
Restore-RDSDBInstanceFromS3-Cmdlet.cs
1086 lines (1017 loc) · 54.9 KB
/
Restore-RDSDBInstanceFromS3-Cmdlet.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*******************************************************************************
* Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* *****************************************************************************
*
* AWS Tools for Windows (TM) PowerShell (TM)
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using Amazon.PowerShell.Common;
using Amazon.Runtime;
using Amazon.RDS;
using Amazon.RDS.Model;
namespace Amazon.PowerShell.Cmdlets.RDS
{
/// <summary>
/// Amazon Relational Database Service (Amazon RDS) supports importing MySQL databases
/// by using backup files. You can create a backup of your on-premises database, store
/// it on Amazon Simple Storage Service (Amazon S3), and then restore the backup file
/// onto a new Amazon RDS DB instance running MySQL. For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Importing.html">Importing
/// Data into an Amazon RDS MySQL DB Instance</a> in the <i>Amazon RDS User Guide.</i><para>
/// This command doesn't apply to RDS Custom.
/// </para>
/// </summary>
[Cmdlet("Restore", "RDSDBInstanceFromS3", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)]
[OutputType("Amazon.RDS.Model.DBInstance")]
[AWSCmdlet("Calls the Amazon Relational Database Service RestoreDBInstanceFromS3 API operation.", Operation = new[] {"RestoreDBInstanceFromS3"}, SelectReturnType = typeof(Amazon.RDS.Model.RestoreDBInstanceFromS3Response))]
[AWSCmdletOutput("Amazon.RDS.Model.DBInstance or Amazon.RDS.Model.RestoreDBInstanceFromS3Response",
"This cmdlet returns an Amazon.RDS.Model.DBInstance object.",
"The service call response (type Amazon.RDS.Model.RestoreDBInstanceFromS3Response) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack."
)]
public partial class RestoreRDSDBInstanceFromS3Cmdlet : AmazonRDSClientCmdlet, IExecutor
{
#region Parameter AllocatedStorage
/// <summary>
/// <para>
/// <para>The amount of storage (in gigabytes) to allocate initially for the DB instance. Follow
/// the allocation rules specified in <code>CreateDBInstance</code>. </para><note><para>Be sure to allocate enough memory for your new DB instance so that the restore operation
/// can succeed. You can also allocate additional memory for future growth. </para></note>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int32? AllocatedStorage { get; set; }
#endregion
#region Parameter AutoMinorVersionUpgrade
/// <summary>
/// <para>
/// <para>A value that indicates whether minor engine upgrades are applied automatically to
/// the DB instance during the maintenance window. By default, minor engine upgrades are
/// not applied automatically. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? AutoMinorVersionUpgrade { get; set; }
#endregion
#region Parameter AvailabilityZone
/// <summary>
/// <para>
/// <para>The Availability Zone that the DB instance is created in. For information about Amazon
/// Web Services Regions and Availability Zones, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html">Regions
/// and Availability Zones</a> in the <i>Amazon RDS User Guide.</i></para><para>Default: A random, system-chosen Availability Zone in the endpoint's Amazon Web Services
/// Region. </para><para> Example: <code>us-east-1d</code></para><para>Constraint: The <code>AvailabilityZone</code> parameter can't be specified if the
/// DB instance is a Multi-AZ deployment. The specified Availability Zone must be in the
/// same Amazon Web Services Region as the current endpoint. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String AvailabilityZone { get; set; }
#endregion
#region Parameter BackupRetentionPeriod
/// <summary>
/// <para>
/// <para>The number of days for which automated backups are retained. Setting this parameter
/// to a positive number enables backups. For more information, see <code>CreateDBInstance</code>.
/// </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int32? BackupRetentionPeriod { get; set; }
#endregion
#region Parameter CopyTagsToSnapshot
/// <summary>
/// <para>
/// <para>A value that indicates whether to copy all tags from the DB instance to snapshots
/// of the DB instance. By default, tags are not copied. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? CopyTagsToSnapshot { get; set; }
#endregion
#region Parameter DBInstanceClass
/// <summary>
/// <para>
/// <para>The compute and memory capacity of the DB instance, for example db.m4.large. Not all
/// DB instance classes are available in all Amazon Web Services Regions, or for all database
/// engines. For the full list of DB instance classes, and availability for your engine,
/// see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html">DB
/// Instance Class</a> in the <i>Amazon RDS User Guide.</i></para><para>Importing from Amazon S3 isn't supported on the db.t2.micro DB instance class. </para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String DBInstanceClass { get; set; }
#endregion
#region Parameter DBInstanceIdentifier
/// <summary>
/// <para>
/// <para>The DB instance identifier. This parameter is stored as a lowercase string. </para><para>Constraints:</para><ul><li><para>Must contain from 1 to 63 letters, numbers, or hyphens.</para></li><li><para>First character must be a letter.</para></li><li><para>Can't end with a hyphen or contain two consecutive hyphens.</para></li></ul><para>Example: <code>mydbinstance</code></para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)]
#else
[System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String DBInstanceIdentifier { get; set; }
#endregion
#region Parameter DBName
/// <summary>
/// <para>
/// <para>The name of the database to create when the DB instance is created. Follow the naming
/// rules specified in <code>CreateDBInstance</code>. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String DBName { get; set; }
#endregion
#region Parameter DBParameterGroupName
/// <summary>
/// <para>
/// <para>The name of the DB parameter group to associate with this DB instance.</para><para>If you do not specify a value for <code>DBParameterGroupName</code>, then the default
/// <code>DBParameterGroup</code> for the specified DB engine is used.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String DBParameterGroupName { get; set; }
#endregion
#region Parameter DBSecurityGroup
/// <summary>
/// <para>
/// <para>A list of DB security groups to associate with this DB instance.</para><para>Default: The default DB security group for the database engine.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("DBSecurityGroups")]
public System.String[] DBSecurityGroup { get; set; }
#endregion
#region Parameter DBSubnetGroupName
/// <summary>
/// <para>
/// <para>A DB subnet group to associate with this DB instance.</para><para>Constraints: If supplied, must match the name of an existing DBSubnetGroup.</para><para>Example: <code>mydbsubnetgroup</code></para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String DBSubnetGroupName { get; set; }
#endregion
#region Parameter DeletionProtection
/// <summary>
/// <para>
/// <para>A value that indicates whether the DB instance has deletion protection enabled. The
/// database can't be deleted when deletion protection is enabled. By default, deletion
/// protection isn't enabled. For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DeleteInstance.html">
/// Deleting a DB Instance</a>. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? DeletionProtection { get; set; }
#endregion
#region Parameter EnableCloudwatchLogsExport
/// <summary>
/// <para>
/// <para>The list of logs that the restored DB instance is to export to CloudWatch Logs. The
/// values in the list depend on the DB engine being used. For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch">Publishing
/// Database Logs to Amazon CloudWatch Logs</a> in the <i>Amazon RDS User Guide</i>.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("EnableCloudwatchLogsExports")]
public System.String[] EnableCloudwatchLogsExport { get; set; }
#endregion
#region Parameter EnableIAMDatabaseAuthentication
/// <summary>
/// <para>
/// <para>A value that indicates whether to enable mapping of Amazon Web Services Identity and
/// Access Management (IAM) accounts to database accounts. By default, mapping isn't enabled.</para><para>For more information about IAM database authentication, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html">
/// IAM Database Authentication for MySQL and PostgreSQL</a> in the <i>Amazon RDS User
/// Guide.</i></para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? EnableIAMDatabaseAuthentication { get; set; }
#endregion
#region Parameter EnablePerformanceInsight
/// <summary>
/// <para>
/// <para>A value that indicates whether to enable Performance Insights for the DB instance.
/// </para><para>For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html">Using
/// Amazon Performance Insights</a> in the <i>Amazon Relational Database Service User
/// Guide</i>. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("EnablePerformanceInsights")]
public System.Boolean? EnablePerformanceInsight { get; set; }
#endregion
#region Parameter Engine
/// <summary>
/// <para>
/// <para>The name of the database engine to be used for this instance. </para><para>Valid Values: <code>mysql</code></para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String Engine { get; set; }
#endregion
#region Parameter EngineVersion
/// <summary>
/// <para>
/// <para>The version number of the database engine to use. Choose the latest minor version
/// of your database engine. For information about engine versions, see <code>CreateDBInstance</code>,
/// or call <code>DescribeDBEngineVersions</code>. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String EngineVersion { get; set; }
#endregion
#region Parameter Iops
/// <summary>
/// <para>
/// <para>The amount of Provisioned IOPS (input/output operations per second) to allocate initially
/// for the DB instance. For information about valid Iops values, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS">Amazon
/// RDS Provisioned IOPS Storage to Improve Performance</a> in the <i>Amazon RDS User
/// Guide.</i></para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int32? Iops { get; set; }
#endregion
#region Parameter KmsKeyId
/// <summary>
/// <para>
/// <para>The Amazon Web Services KMS key identifier for an encrypted DB instance. </para><para>The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias
/// name for the KMS key. To use a KMS key in a different Amazon Web Services account,
/// specify the key ARN or alias ARN.</para><para>If the <code>StorageEncrypted</code> parameter is enabled, and you do not specify
/// a value for the <code>KmsKeyId</code> parameter, then Amazon RDS will use your default
/// KMS key. There is a default KMS key for your Amazon Web Services account. Your Amazon
/// Web Services account has a different default KMS key for each Amazon Web Services
/// Region. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String KmsKeyId { get; set; }
#endregion
#region Parameter LicenseModel
/// <summary>
/// <para>
/// <para>The license model for this DB instance. Use <code>general-public-license</code>. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String LicenseModel { get; set; }
#endregion
#region Parameter MasterUsername
/// <summary>
/// <para>
/// <para>The name for the master user. </para><para>Constraints: </para><ul><li><para>Must be 1 to 16 letters or numbers.</para></li><li><para>First character must be a letter.</para></li><li><para>Can't be a reserved word for the chosen database engine.</para></li></ul>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String MasterUsername { get; set; }
#endregion
#region Parameter MasterUserPassword
/// <summary>
/// <para>
/// <para>The password for the master user. The password can include any printable ASCII character
/// except "/", """, or "@". </para><para>Constraints: Must contain from 8 to 41 characters.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String MasterUserPassword { get; set; }
#endregion
#region Parameter MaxAllocatedStorage
/// <summary>
/// <para>
/// <para>The upper limit in gibibytes (GiB) to which Amazon RDS can automatically scale the
/// storage of the DB instance.</para><para>For more information about this setting, including limitations that apply to it, see
/// <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.Autoscaling">
/// Managing capacity automatically with Amazon RDS storage autoscaling</a> in the <i>Amazon
/// RDS User Guide</i>.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int32? MaxAllocatedStorage { get; set; }
#endregion
#region Parameter MonitoringInterval
/// <summary>
/// <para>
/// <para>The interval, in seconds, between points when Enhanced Monitoring metrics are collected
/// for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0.
/// </para><para>If <code>MonitoringRoleArn</code> is specified, then you must also set <code>MonitoringInterval</code>
/// to a value other than 0. </para><para>Valid Values: 0, 1, 5, 10, 15, 30, 60 </para><para>Default: <code>0</code></para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int32? MonitoringInterval { get; set; }
#endregion
#region Parameter MonitoringRoleArn
/// <summary>
/// <para>
/// <para>The ARN for the IAM role that permits RDS to send enhanced monitoring metrics to Amazon
/// CloudWatch Logs. For example, <code>arn:aws:iam:123456789012:role/emaccess</code>.
/// For information on creating a monitoring role, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.OS.html#USER_Monitoring.OS.Enabling">Setting
/// Up and Enabling Enhanced Monitoring</a> in the <i>Amazon RDS User Guide.</i></para><para>If <code>MonitoringInterval</code> is set to a value other than 0, then you must supply
/// a <code>MonitoringRoleArn</code> value. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String MonitoringRoleArn { get; set; }
#endregion
#region Parameter MultiAZ
/// <summary>
/// <para>
/// <para>A value that indicates whether the DB instance is a Multi-AZ deployment. If the DB
/// instance is a Multi-AZ deployment, you can't set the <code>AvailabilityZone</code>
/// parameter. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? MultiAZ { get; set; }
#endregion
#region Parameter OptionGroupName
/// <summary>
/// <para>
/// <para>The name of the option group to associate with this DB instance. If this argument
/// is omitted, the default option group for the specified engine is used. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String OptionGroupName { get; set; }
#endregion
#region Parameter PerformanceInsightsKMSKeyId
/// <summary>
/// <para>
/// <para>The Amazon Web Services KMS key identifier for encryption of Performance Insights
/// data.</para><para>The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias
/// name for the KMS key.</para><para>If you do not specify a value for <code>PerformanceInsightsKMSKeyId</code>, then Amazon
/// RDS uses your default KMS key. There is a default KMS key for your Amazon Web Services
/// account. Your Amazon Web Services account has a different default KMS key for each
/// Amazon Web Services Region.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String PerformanceInsightsKMSKeyId { get; set; }
#endregion
#region Parameter PerformanceInsightsRetentionPeriod
/// <summary>
/// <para>
/// <para>The amount of time, in days, to retain Performance Insights data. Valid values are
/// 7 or 731 (2 years). </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int32? PerformanceInsightsRetentionPeriod { get; set; }
#endregion
#region Parameter Port
/// <summary>
/// <para>
/// <para>The port number on which the database accepts connections. </para><para>Type: Integer </para><para>Valid Values: <code>1150</code>-<code>65535</code></para><para>Default: <code>3306</code></para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int32? Port { get; set; }
#endregion
#region Parameter PreferredBackupWindow
/// <summary>
/// <para>
/// <para>The time range each day during which automated backups are created if automated backups
/// are enabled. For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow">Backup
/// window</a> in the <i>Amazon RDS User Guide.</i></para><para>Constraints:</para><ul><li><para>Must be in the format <code>hh24:mi-hh24:mi</code>.</para></li><li><para>Must be in Universal Coordinated Time (UTC).</para></li><li><para>Must not conflict with the preferred maintenance window.</para></li><li><para>Must be at least 30 minutes.</para></li></ul>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String PreferredBackupWindow { get; set; }
#endregion
#region Parameter PreferredMaintenanceWindow
/// <summary>
/// <para>
/// <para>The time range each week during which system maintenance can occur, in Universal Coordinated
/// Time (UTC). For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance">Amazon
/// RDS Maintenance Window</a> in the <i>Amazon RDS User Guide.</i></para><para>Constraints:</para><ul><li><para>Must be in the format <code>ddd:hh24:mi-ddd:hh24:mi</code>.</para></li><li><para>Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun.</para></li><li><para>Must be in Universal Coordinated Time (UTC).</para></li><li><para>Must not conflict with the preferred backup window.</para></li><li><para>Must be at least 30 minutes.</para></li></ul>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String PreferredMaintenanceWindow { get; set; }
#endregion
#region Parameter ProcessorFeature
/// <summary>
/// <para>
/// <para>The number of CPU cores and the number of threads per core for the DB instance class
/// of the DB instance.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("ProcessorFeatures")]
public Amazon.RDS.Model.ProcessorFeature[] ProcessorFeature { get; set; }
#endregion
#region Parameter PubliclyAccessible
/// <summary>
/// <para>
/// <para>A value that indicates whether the DB instance is publicly accessible.</para><para>When the DB instance is publicly accessible, its Domain Name System (DNS) endpoint
/// resolves to the private IP address from within the DB instance's virtual private cloud
/// (VPC). It resolves to the public IP address from outside of the DB instance's VPC.
/// Access to the DB instance is ultimately controlled by the security group it uses.
/// That public access is not permitted if the security group assigned to the DB instance
/// doesn't permit it.</para><para>When the DB instance isn't publicly accessible, it is an internal DB instance with
/// a DNS name that resolves to a private IP address.</para><para>For more information, see <a>CreateDBInstance</a>.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? PubliclyAccessible { get; set; }
#endregion
#region Parameter S3BucketName
/// <summary>
/// <para>
/// <para>The name of your Amazon S3 bucket that contains your database backup file. </para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String S3BucketName { get; set; }
#endregion
#region Parameter S3IngestionRoleArn
/// <summary>
/// <para>
/// <para>An Amazon Web Services Identity and Access Management (IAM) role to allow Amazon RDS
/// to access your Amazon S3 bucket. </para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String S3IngestionRoleArn { get; set; }
#endregion
#region Parameter S3Prefix
/// <summary>
/// <para>
/// <para>The prefix of your Amazon S3 bucket. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String S3Prefix { get; set; }
#endregion
#region Parameter SourceEngine
/// <summary>
/// <para>
/// <para>The name of the engine of your source database. </para><para>Valid Values: <code>mysql</code></para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String SourceEngine { get; set; }
#endregion
#region Parameter SourceEngineVersion
/// <summary>
/// <para>
/// <para>The version of the database that the backup files were created from.</para><para>MySQL versions 5.6 and 5.7 are supported. </para><para>Example: <code>5.6.40</code></para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String SourceEngineVersion { get; set; }
#endregion
#region Parameter StorageEncrypted
/// <summary>
/// <para>
/// <para>A value that indicates whether the new DB instance is encrypted or not. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Boolean? StorageEncrypted { get; set; }
#endregion
#region Parameter StorageType
/// <summary>
/// <para>
/// <para>Specifies the storage type to be associated with the DB instance. </para><para>Valid values: <code>standard</code> | <code>gp2</code> | <code>io1</code></para><para>If you specify <code>io1</code>, you must also include a value for the <code>Iops</code>
/// parameter. </para><para>Default: <code>io1</code> if the <code>Iops</code> parameter is specified; otherwise
/// <code>gp2</code></para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String StorageType { get; set; }
#endregion
#region Parameter Tag
/// <summary>
/// <para>
/// <para>A list of tags to associate with this DB instance. For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html">Tagging
/// Amazon RDS Resources</a> in the <i>Amazon RDS User Guide.</i></para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("Tags")]
public Amazon.RDS.Model.Tag[] Tag { get; set; }
#endregion
#region Parameter UseDefaultProcessorFeature
/// <summary>
/// <para>
/// <para>A value that indicates whether the DB instance class of the DB instance uses its default
/// processor features.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("UseDefaultProcessorFeatures")]
public System.Boolean? UseDefaultProcessorFeature { get; set; }
#endregion
#region Parameter VpcSecurityGroupId
/// <summary>
/// <para>
/// <para>A list of VPC security groups to associate with this DB instance. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("VpcSecurityGroupIds")]
public System.String[] VpcSecurityGroupId { get; set; }
#endregion
#region Parameter Select
/// <summary>
/// Use the -Select parameter to control the cmdlet output. The default value is 'DBInstance'.
/// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.RDS.Model.RestoreDBInstanceFromS3Response).
/// Specifying the name of a property of type Amazon.RDS.Model.RestoreDBInstanceFromS3Response will result in that property being returned.
/// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public string Select { get; set; } = "DBInstance";
#endregion
#region Parameter PassThru
/// <summary>
/// Changes the cmdlet behavior to return the value passed to the DBInstanceIdentifier parameter.
/// The -PassThru parameter is deprecated, use -Select '^DBInstanceIdentifier' instead. This parameter will be removed in a future version.
/// </summary>
[System.Obsolete("The -PassThru parameter is deprecated, use -Select '^DBInstanceIdentifier' instead. This parameter will be removed in a future version.")]
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public SwitchParameter PassThru { get; set; }
#endregion
#region Parameter Force
/// <summary>
/// This parameter overrides confirmation prompts to force
/// the cmdlet to continue its operation. This parameter should always
/// be used with caution.
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public SwitchParameter Force { get; set; }
#endregion
protected override void ProcessRecord()
{
base.ProcessRecord();
var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.DBInstanceIdentifier), MyInvocation.BoundParameters);
if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Restore-RDSDBInstanceFromS3 (RestoreDBInstanceFromS3)"))
{
return;
}
var context = new CmdletContext();
// allow for manipulation of parameters prior to loading into context
PreExecutionContextLoad(context);
#pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
if (ParameterWasBound(nameof(this.Select)))
{
context.Select = CreateSelectDelegate<Amazon.RDS.Model.RestoreDBInstanceFromS3Response, RestoreRDSDBInstanceFromS3Cmdlet>(Select) ??
throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
if (this.PassThru.IsPresent)
{
throw new System.ArgumentException("-PassThru cannot be used when -Select is specified.", nameof(this.Select));
}
}
else if (this.PassThru.IsPresent)
{
context.Select = (response, cmdlet) => this.DBInstanceIdentifier;
}
#pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
context.AllocatedStorage = this.AllocatedStorage;
context.AutoMinorVersionUpgrade = this.AutoMinorVersionUpgrade;
context.AvailabilityZone = this.AvailabilityZone;
context.BackupRetentionPeriod = this.BackupRetentionPeriod;
context.CopyTagsToSnapshot = this.CopyTagsToSnapshot;
context.DBInstanceClass = this.DBInstanceClass;
#if MODULAR
if (this.DBInstanceClass == null && ParameterWasBound(nameof(this.DBInstanceClass)))
{
WriteWarning("You are passing $null as a value for parameter DBInstanceClass which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.DBInstanceIdentifier = this.DBInstanceIdentifier;
#if MODULAR
if (this.DBInstanceIdentifier == null && ParameterWasBound(nameof(this.DBInstanceIdentifier)))
{
WriteWarning("You are passing $null as a value for parameter DBInstanceIdentifier which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.DBName = this.DBName;
context.DBParameterGroupName = this.DBParameterGroupName;
if (this.DBSecurityGroup != null)
{
context.DBSecurityGroup = new List<System.String>(this.DBSecurityGroup);
}
context.DBSubnetGroupName = this.DBSubnetGroupName;
context.DeletionProtection = this.DeletionProtection;
if (this.EnableCloudwatchLogsExport != null)
{
context.EnableCloudwatchLogsExport = new List<System.String>(this.EnableCloudwatchLogsExport);
}
context.EnableIAMDatabaseAuthentication = this.EnableIAMDatabaseAuthentication;
context.EnablePerformanceInsight = this.EnablePerformanceInsight;
context.Engine = this.Engine;
#if MODULAR
if (this.Engine == null && ParameterWasBound(nameof(this.Engine)))
{
WriteWarning("You are passing $null as a value for parameter Engine which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.EngineVersion = this.EngineVersion;
context.Iops = this.Iops;
context.KmsKeyId = this.KmsKeyId;
context.LicenseModel = this.LicenseModel;
context.MasterUsername = this.MasterUsername;
context.MasterUserPassword = this.MasterUserPassword;
context.MaxAllocatedStorage = this.MaxAllocatedStorage;
context.MonitoringInterval = this.MonitoringInterval;
context.MonitoringRoleArn = this.MonitoringRoleArn;
context.MultiAZ = this.MultiAZ;
context.OptionGroupName = this.OptionGroupName;
context.PerformanceInsightsKMSKeyId = this.PerformanceInsightsKMSKeyId;
context.PerformanceInsightsRetentionPeriod = this.PerformanceInsightsRetentionPeriod;
context.Port = this.Port;
context.PreferredBackupWindow = this.PreferredBackupWindow;
context.PreferredMaintenanceWindow = this.PreferredMaintenanceWindow;
if (this.ProcessorFeature != null)
{
context.ProcessorFeature = new List<Amazon.RDS.Model.ProcessorFeature>(this.ProcessorFeature);
}
context.PubliclyAccessible = this.PubliclyAccessible;
context.S3BucketName = this.S3BucketName;
#if MODULAR
if (this.S3BucketName == null && ParameterWasBound(nameof(this.S3BucketName)))
{
WriteWarning("You are passing $null as a value for parameter S3BucketName which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.S3IngestionRoleArn = this.S3IngestionRoleArn;
#if MODULAR
if (this.S3IngestionRoleArn == null && ParameterWasBound(nameof(this.S3IngestionRoleArn)))
{
WriteWarning("You are passing $null as a value for parameter S3IngestionRoleArn which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.S3Prefix = this.S3Prefix;
context.SourceEngine = this.SourceEngine;
#if MODULAR
if (this.SourceEngine == null && ParameterWasBound(nameof(this.SourceEngine)))
{
WriteWarning("You are passing $null as a value for parameter SourceEngine which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.SourceEngineVersion = this.SourceEngineVersion;
#if MODULAR
if (this.SourceEngineVersion == null && ParameterWasBound(nameof(this.SourceEngineVersion)))
{
WriteWarning("You are passing $null as a value for parameter SourceEngineVersion which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.StorageEncrypted = this.StorageEncrypted;
context.StorageType = this.StorageType;
if (this.Tag != null)
{
context.Tag = new List<Amazon.RDS.Model.Tag>(this.Tag);
}
context.UseDefaultProcessorFeature = this.UseDefaultProcessorFeature;
if (this.VpcSecurityGroupId != null)
{
context.VpcSecurityGroupId = new List<System.String>(this.VpcSecurityGroupId);
}
// allow further manipulation of loaded context prior to processing
PostExecutionContextLoad(context);
var output = Execute(context) as CmdletOutput;
ProcessOutput(output);
}
#region IExecutor Members
public object Execute(ExecutorContext context)
{
var cmdletContext = context as CmdletContext;
// create request
var request = new Amazon.RDS.Model.RestoreDBInstanceFromS3Request();
if (cmdletContext.AllocatedStorage != null)
{
request.AllocatedStorage = cmdletContext.AllocatedStorage.Value;
}
if (cmdletContext.AutoMinorVersionUpgrade != null)
{
request.AutoMinorVersionUpgrade = cmdletContext.AutoMinorVersionUpgrade.Value;
}
if (cmdletContext.AvailabilityZone != null)
{
request.AvailabilityZone = cmdletContext.AvailabilityZone;
}
if (cmdletContext.BackupRetentionPeriod != null)
{
request.BackupRetentionPeriod = cmdletContext.BackupRetentionPeriod.Value;
}
if (cmdletContext.CopyTagsToSnapshot != null)
{
request.CopyTagsToSnapshot = cmdletContext.CopyTagsToSnapshot.Value;
}
if (cmdletContext.DBInstanceClass != null)
{
request.DBInstanceClass = cmdletContext.DBInstanceClass;
}
if (cmdletContext.DBInstanceIdentifier != null)
{
request.DBInstanceIdentifier = cmdletContext.DBInstanceIdentifier;
}
if (cmdletContext.DBName != null)
{
request.DBName = cmdletContext.DBName;
}
if (cmdletContext.DBParameterGroupName != null)
{
request.DBParameterGroupName = cmdletContext.DBParameterGroupName;
}
if (cmdletContext.DBSecurityGroup != null)
{
request.DBSecurityGroups = cmdletContext.DBSecurityGroup;
}
if (cmdletContext.DBSubnetGroupName != null)
{
request.DBSubnetGroupName = cmdletContext.DBSubnetGroupName;
}
if (cmdletContext.DeletionProtection != null)
{
request.DeletionProtection = cmdletContext.DeletionProtection.Value;
}
if (cmdletContext.EnableCloudwatchLogsExport != null)
{
request.EnableCloudwatchLogsExports = cmdletContext.EnableCloudwatchLogsExport;
}
if (cmdletContext.EnableIAMDatabaseAuthentication != null)
{
request.EnableIAMDatabaseAuthentication = cmdletContext.EnableIAMDatabaseAuthentication.Value;
}
if (cmdletContext.EnablePerformanceInsight != null)
{
request.EnablePerformanceInsights = cmdletContext.EnablePerformanceInsight.Value;
}
if (cmdletContext.Engine != null)
{
request.Engine = cmdletContext.Engine;
}
if (cmdletContext.EngineVersion != null)
{
request.EngineVersion = cmdletContext.EngineVersion;
}
if (cmdletContext.Iops != null)
{
request.Iops = cmdletContext.Iops.Value;
}
if (cmdletContext.KmsKeyId != null)
{
request.KmsKeyId = cmdletContext.KmsKeyId;
}
if (cmdletContext.LicenseModel != null)
{
request.LicenseModel = cmdletContext.LicenseModel;
}
if (cmdletContext.MasterUsername != null)
{
request.MasterUsername = cmdletContext.MasterUsername;
}
if (cmdletContext.MasterUserPassword != null)
{
request.MasterUserPassword = cmdletContext.MasterUserPassword;
}
if (cmdletContext.MaxAllocatedStorage != null)
{
request.MaxAllocatedStorage = cmdletContext.MaxAllocatedStorage.Value;
}
if (cmdletContext.MonitoringInterval != null)
{
request.MonitoringInterval = cmdletContext.MonitoringInterval.Value;
}
if (cmdletContext.MonitoringRoleArn != null)
{
request.MonitoringRoleArn = cmdletContext.MonitoringRoleArn;
}
if (cmdletContext.MultiAZ != null)
{
request.MultiAZ = cmdletContext.MultiAZ.Value;
}
if (cmdletContext.OptionGroupName != null)
{
request.OptionGroupName = cmdletContext.OptionGroupName;
}
if (cmdletContext.PerformanceInsightsKMSKeyId != null)
{
request.PerformanceInsightsKMSKeyId = cmdletContext.PerformanceInsightsKMSKeyId;
}
if (cmdletContext.PerformanceInsightsRetentionPeriod != null)
{
request.PerformanceInsightsRetentionPeriod = cmdletContext.PerformanceInsightsRetentionPeriod.Value;
}
if (cmdletContext.Port != null)
{
request.Port = cmdletContext.Port.Value;
}
if (cmdletContext.PreferredBackupWindow != null)
{
request.PreferredBackupWindow = cmdletContext.PreferredBackupWindow;
}
if (cmdletContext.PreferredMaintenanceWindow != null)
{
request.PreferredMaintenanceWindow = cmdletContext.PreferredMaintenanceWindow;
}
if (cmdletContext.ProcessorFeature != null)
{
request.ProcessorFeatures = cmdletContext.ProcessorFeature;
}
if (cmdletContext.PubliclyAccessible != null)
{
request.PubliclyAccessible = cmdletContext.PubliclyAccessible.Value;
}
if (cmdletContext.S3BucketName != null)
{
request.S3BucketName = cmdletContext.S3BucketName;
}
if (cmdletContext.S3IngestionRoleArn != null)
{
request.S3IngestionRoleArn = cmdletContext.S3IngestionRoleArn;
}
if (cmdletContext.S3Prefix != null)
{
request.S3Prefix = cmdletContext.S3Prefix;
}
if (cmdletContext.SourceEngine != null)
{
request.SourceEngine = cmdletContext.SourceEngine;
}
if (cmdletContext.SourceEngineVersion != null)
{
request.SourceEngineVersion = cmdletContext.SourceEngineVersion;
}
if (cmdletContext.StorageEncrypted != null)
{
request.StorageEncrypted = cmdletContext.StorageEncrypted.Value;
}
if (cmdletContext.StorageType != null)
{
request.StorageType = cmdletContext.StorageType;
}
if (cmdletContext.Tag != null)
{
request.Tags = cmdletContext.Tag;
}
if (cmdletContext.UseDefaultProcessorFeature != null)
{
request.UseDefaultProcessorFeatures = cmdletContext.UseDefaultProcessorFeature.Value;
}
if (cmdletContext.VpcSecurityGroupId != null)
{
request.VpcSecurityGroupIds = cmdletContext.VpcSecurityGroupId;
}
CmdletOutput output;
// issue call
var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
try
{
var response = CallAWSServiceOperation(client, request);
object pipelineOutput = null;
pipelineOutput = cmdletContext.Select(response, this);
output = new CmdletOutput
{
PipelineOutput = pipelineOutput,
ServiceResponse = response
};
}
catch (Exception e)
{
output = new CmdletOutput { ErrorResponse = e };
}
return output;
}
public ExecutorContext CreateContext()