/******************************************************************************* * 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 { /// /// Creates a new DB instance from a DB snapshot. The target database is created from /// the source database restore point with most of the source's original configuration, /// including the default security group and DB parameter group. By default, the new DB /// instance is created as a Single-AZ deployment, except when the instance is a SQL Server /// instance that has an option group associated with mirroring. In this case, the instance /// becomes a Multi-AZ deployment, not a Single-AZ deployment. /// /// /// /// If you want to replace your original DB instance with the new, restored DB instance, /// then rename your original DB instance before you call the RestoreDBInstanceFromDBSnapshot /// action. RDS doesn't allow two DB instances with the same name. After you have renamed /// your original DB instance with a different identifier, then you can pass the original /// name of the DB instance as the DBInstanceIdentifier in the call to the RestoreDBInstanceFromDBSnapshot /// action. The result is that you replace the original DB instance with the DB instance /// created from the snapshot. /// /// If you are restoring from a shared manual DB snapshot, the DBSnapshotIdentifier /// must be the ARN of the shared DB snapshot. /// /// This command doesn't apply to Aurora MySQL and Aurora PostgreSQL. For Aurora, use /// RestoreDBClusterFromSnapshot. /// /// [Cmdlet("Restore", "RDSDBInstanceFromDBSnapshot", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)] [OutputType("Amazon.RDS.Model.DBInstance")] [AWSCmdlet("Calls the Amazon Relational Database Service RestoreDBInstanceFromDBSnapshot API operation.", Operation = new[] {"RestoreDBInstanceFromDBSnapshot"}, SelectReturnType = typeof(Amazon.RDS.Model.RestoreDBInstanceFromDBSnapshotResponse))] [AWSCmdletOutput("Amazon.RDS.Model.DBInstance or Amazon.RDS.Model.RestoreDBInstanceFromDBSnapshotResponse", "This cmdlet returns an Amazon.RDS.Model.DBInstance object.", "The service call response (type Amazon.RDS.Model.RestoreDBInstanceFromDBSnapshotResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack." )] public partial class RestoreRDSDBInstanceFromDBSnapshotCmdlet : AmazonRDSClientCmdlet, IExecutor { #region Parameter AllocatedStorage /// /// /// The amount of storage (in gibibytes) to allocate initially for the DB instance. Follow /// the allocation rules specified in CreateDBInstance.Be sure to allocate enough storage for your new DB instance so that the restore operation /// can succeed. You can also allocate additional storage for future growth. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Int32? AllocatedStorage { get; set; } #endregion #region Parameter AutoMinorVersionUpgrade /// /// /// A value that indicates whether minor version upgrades are applied automatically to /// the DB instance during the maintenance window.If you restore an RDS Custom DB instance, you must disable this parameter. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Boolean? AutoMinorVersionUpgrade { get; set; } #endregion #region Parameter AvailabilityZone /// /// /// The Availability Zone (AZ) where the DB instance will be created.Default: A random, system-chosen Availability Zone.Constraint: You can't specify the AvailabilityZone parameter if the DB /// instance is a Multi-AZ deployment.Example: us-east-1a /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String AvailabilityZone { get; set; } #endregion #region Parameter BackupTarget /// /// /// Specifies where automated backups and manual snapshots are stored for the restored /// DB instance.Possible values are outposts (Amazon Web Services Outposts) and region /// (Amazon Web Services Region). The default is region.For more information, see Working /// with Amazon RDS on Amazon Web Services Outposts in the Amazon RDS User Guide. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String BackupTarget { get; set; } #endregion #region Parameter CopyTagsToSnapshot /// /// /// A value that indicates whether to copy all tags from the restored DB instance to snapshots /// of the DB instance.In most cases, tags aren't copied by default. However, when you restore a DB instance /// from a DB snapshot, RDS checks whether you specify new tags. If yes, the new tags /// are added to the restored DB instance. If there are no new tags, RDS looks for the /// tags from the source DB instance for the DB snapshot, and then adds those tags to /// the restored DB instance.For more information, see /// Copying tags to DB instance snapshots in the Amazon RDS User Guide. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Boolean? CopyTagsToSnapshot { get; set; } #endregion #region Parameter CustomIamInstanceProfile /// /// /// The instance profile associated with the underlying Amazon EC2 instance of an RDS /// Custom DB instance. The instance profile must meet the following requirements:For the list of permissions required for the IAM role, see /// Configure IAM and your VPC in the Amazon RDS User Guide.This setting is required for RDS Custom. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String CustomIamInstanceProfile { get; set; } #endregion #region Parameter DBClusterSnapshotIdentifier /// /// /// The identifier for the RDS for MySQL Multi-AZ DB cluster snapshot to restore from.For more information on Multi-AZ DB clusters, see /// Multi-AZ DB cluster deployments in the Amazon RDS User Guide.Constraints: /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DBClusterSnapshotIdentifier { get; set; } #endregion #region Parameter DBInstanceClass /// /// /// The compute and memory capacity of the Amazon RDS 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 DB /// Instance Class in the Amazon RDS User Guide.Default: The same DBInstanceClass as the original DB instance. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DBInstanceClass { get; set; } #endregion #region Parameter DBInstanceIdentifier /// /// /// Name of the DB instance to create from the DB snapshot. This parameter isn't case-sensitive.Constraints:Example: my-snapshot-id /// /// #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 /// /// /// The database name for the restored DB instance.This parameter doesn't apply to the MySQL, PostgreSQL, or MariaDB engines. It also /// doesn't apply to RDS Custom DB instances. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DBName { get; set; } #endregion #region Parameter DBParameterGroupName /// /// /// The name of the DB parameter group to associate with this DB instance.If you don't specify a value for DBParameterGroupName, then RDS uses /// the default DBParameterGroup for the specified DB engine.This setting doesn't apply to RDS Custom.Constraints: /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DBParameterGroupName { get; set; } #endregion #region Parameter DBSnapshotIdentifier /// /// /// The identifier for the DB snapshot to restore from.Constraints: /// /// [System.Management.Automation.Parameter(Position = 1, ValueFromPipelineByPropertyName = true)] public System.String DBSnapshotIdentifier { get; set; } #endregion #region Parameter DBSubnetGroupName /// /// /// The DB subnet group name to use for the new instance.Constraints: If supplied, must match the name of an existing DBSubnetGroup.Example: mydbsubnetgroup /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DBSubnetGroupName { get; set; } #endregion #region Parameter DeletionProtection /// /// /// 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 /// Deleting a DB Instance. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Boolean? DeletionProtection { get; set; } #endregion #region Parameter Domain /// /// /// Specify the Active Directory directory ID to restore the DB instance in. The domain/ /// must be created prior to this operation. Currently, you can create only MySQL, Microsoft /// SQL Server, Oracle, and PostgreSQL DB instances in an Active Directory Domain.For more information, see /// Kerberos Authentication in the Amazon RDS User Guide.This setting doesn't apply to RDS Custom. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String Domain { get; set; } #endregion #region Parameter DomainAuthSecretArn /// /// /// The ARN for the Secrets Manager secret with the credentials for the user joining the /// domain.Constraints:Example: arn:aws:secretsmanager:region:account-number:secret:myselfmanagedADtestsecret-123456 /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DomainAuthSecretArn { get; set; } #endregion #region Parameter DomainDnsIp /// /// /// The IPv4 DNS IP addresses of your primary and secondary Active Directory domain controllers.Constraints:Example: 123.124.125.126,234.235.236.237 /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("DomainDnsIps")] public System.String[] DomainDnsIp { get; set; } #endregion #region Parameter DomainFqdn /// /// /// The fully qualified domain name (FQDN) of an Active Directory domain.Constraints:Example: mymanagedADtest.mymanagedAD.mydomain /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DomainFqdn { get; set; } #endregion #region Parameter DomainIAMRoleName /// /// /// The name of the IAM role to use when making API calls to the Directory Service.This setting doesn't apply to RDS Custom DB instances. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DomainIAMRoleName { get; set; } #endregion #region Parameter DomainOu /// /// /// The Active Directory organizational unit for your DB instance to join.Constraints:Example: OU=mymanagedADtestOU,DC=mymanagedADtest,DC=mymanagedAD,DC=mydomain /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DomainOu { get; set; } #endregion #region Parameter EnableCloudwatchLogsExport /// /// /// 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 Publishing /// Database Logs to Amazon CloudWatch Logs in the Amazon RDS User Guide.This setting doesn't apply to RDS Custom. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("EnableCloudwatchLogsExports")] public System.String[] EnableCloudwatchLogsExport { get; set; } #endregion #region Parameter EnableCustomerOwnedIp /// /// /// A value that indicates whether to enable a customer-owned IP address (CoIP) for an /// RDS on Outposts DB instance.A CoIP provides local or external connectivity to resources in your Outpost /// subnets through your on-premises network. For some use cases, a CoIP can provide lower /// latency for connections to the DB instance from outside of its virtual private cloud /// (VPC) on your local network.This setting doesn't apply to RDS Custom.For more information about RDS on Outposts, see Working /// with Amazon RDS on Amazon Web Services Outposts in the Amazon RDS User Guide.For more information about CoIPs, see Customer-owned /// IP addresses in the Amazon Web Services Outposts User Guide. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Boolean? EnableCustomerOwnedIp { get; set; } #endregion #region Parameter EnableIAMDatabaseAuthentication /// /// /// A value that indicates whether to enable mapping of Amazon Web Services Identity and /// Access Management (IAM) accounts to database accounts. By default, mapping is disabled.For more information about IAM database authentication, see /// IAM Database Authentication for MySQL and PostgreSQL in the Amazon RDS User /// Guide.This setting doesn't apply to RDS Custom. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Boolean? EnableIAMDatabaseAuthentication { get; set; } #endregion #region Parameter Engine /// /// /// The database engine to use for the new instance.This setting doesn't apply to RDS Custom.Default: The same as sourceConstraint: Must be compatible with the engine of the source. For example, you can /// restore a MariaDB 10.1 DB instance from a MySQL 5.6 snapshot.Valid Values: /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String Engine { get; set; } #endregion #region Parameter Iops /// /// /// Specifies the amount of provisioned IOPS for the DB instance, expressed in I/O operations /// per second. If this parameter isn't specified, the IOPS value is taken from the backup. /// If this parameter is set to 0, the new instance is converted to a non-PIOPS instance. /// The conversion takes additional time, though your DB instance is available for connections /// before the conversion starts.The provisioned IOPS value must follow the requirements for your database engine. /// For more information, see Amazon /// RDS Provisioned IOPS storage in the Amazon RDS User Guide.Constraints: Must be an integer greater than 1000. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Int32? Iops { get; set; } #endregion #region Parameter LicenseModel /// /// /// License model information for the restored DB instance.This setting doesn't apply to RDS Custom.Default: Same as source.Valid values: license-included | bring-your-own-license /// | general-public-license /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String LicenseModel { get; set; } #endregion #region Parameter MultiAZ /// /// /// A value that indicates whether the DB instance is a Multi-AZ deployment.This setting doesn't apply to RDS Custom.Constraint: You can't specify the AvailabilityZone parameter if the DB /// instance is a Multi-AZ deployment. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Boolean? MultiAZ { get; set; } #endregion #region Parameter NetworkType /// /// /// The network type of the DB instance.Valid values:The network type is determined by the DBSubnetGroup specified for the /// DB instance. A DBSubnetGroup can support only the IPv4 protocol or the /// IPv4 and the IPv6 protocols (DUAL).For more information, see /// Working with a DB instance in a VPC in the Amazon RDS User Guide. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String NetworkType { get; set; } #endregion #region Parameter OptionGroupName /// /// /// The name of the option group to be used for the restored DB instance.Permanent options, such as the TDE option for Oracle Advanced Security TDE, can't /// be removed from an option group, and that option group can't be removed from a DB /// instance after it is associated with a DB instance.This setting doesn't apply to RDS Custom. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String OptionGroupName { get; set; } #endregion #region Parameter Port /// /// /// The port number on which the database accepts connections.Default: The same port as the original DB instanceConstraints: Value must be 1150-65535 /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Int32? Port { get; set; } #endregion #region Parameter ProcessorFeature /// /// /// The number of CPU cores and the number of threads per core for the DB instance class /// of the DB instance.This setting doesn't apply to RDS Custom. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("ProcessorFeatures")] public Amazon.RDS.Model.ProcessorFeature[] ProcessorFeature { get; set; } #endregion #region Parameter PubliclyAccessible /// /// /// A value that indicates whether the DB instance is publicly accessible.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.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.For more information, see CreateDBInstance. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Boolean? PubliclyAccessible { get; set; } #endregion #region Parameter StorageThroughput /// /// /// Specifies the storage throughput value for the DB instance.This setting doesn't apply to RDS Custom or Amazon Aurora. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Int32? StorageThroughput { get; set; } #endregion #region Parameter StorageType /// /// /// Specifies the storage type to be associated with the DB instance.Valid values: gp2 | gp3 | io1 | standardIf you specify io1 or gp3, you must also include a value /// for the Iops parameter.Default: io1 if the Iops parameter is specified, otherwise /// gp2 /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String StorageType { get; set; } #endregion #region Parameter Tag /// /// /// The service has not provided documentation for this parameter; please refer to the service's API reference documentation for the latest available information. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("Tags")] public Amazon.RDS.Model.Tag[] Tag { get; set; } #endregion #region Parameter TdeCredentialArn /// /// /// The ARN from the key store with which to associate the instance for TDE encryption.This setting doesn't apply to RDS Custom. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String TdeCredentialArn { get; set; } #endregion #region Parameter TdeCredentialPassword /// /// /// The password for the given ARN from the key store in order to access the device.This setting doesn't apply to RDS Custom. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String TdeCredentialPassword { get; set; } #endregion #region Parameter UseDefaultProcessorFeature /// /// /// A value that indicates whether the DB instance class of the DB instance uses its default /// processor features.This setting doesn't apply to RDS Custom. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("UseDefaultProcessorFeatures")] public System.Boolean? UseDefaultProcessorFeature { get; set; } #endregion #region Parameter VpcSecurityGroupId /// /// /// A list of EC2 VPC security groups to associate with this DB instance.Default: The default EC2 VPC security group for the DB subnet group's VPC. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("VpcSecurityGroupIds")] public System.String[] VpcSecurityGroupId { get; set; } #endregion #region Parameter Select /// /// 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.RestoreDBInstanceFromDBSnapshotResponse). /// Specifying the name of a property of type Amazon.RDS.Model.RestoreDBInstanceFromDBSnapshotResponse will result in that property being returned. /// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value. /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public string Select { get; set; } = "DBInstance"; #endregion #region Parameter PassThru /// /// 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. /// [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 /// /// This parameter overrides confirmation prompts to force /// the cmdlet to continue its operation. This parameter should always /// be used with caution. /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter Force { get; set; } #endregion protected override void ProcessRecord() { this._AWSSignerType = "v4"; base.ProcessRecord(); var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.DBInstanceIdentifier), MyInvocation.BoundParameters); if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Restore-RDSDBInstanceFromDBSnapshot (RestoreDBInstanceFromDBSnapshot)")) { 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(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.BackupTarget = this.BackupTarget; context.CopyTagsToSnapshot = this.CopyTagsToSnapshot; context.CustomIamInstanceProfile = this.CustomIamInstanceProfile; context.DBClusterSnapshotIdentifier = this.DBClusterSnapshotIdentifier; context.DBInstanceClass = this.DBInstanceClass; 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; context.DBSnapshotIdentifier = this.DBSnapshotIdentifier; context.DBSubnetGroupName = this.DBSubnetGroupName; context.DeletionProtection = this.DeletionProtection; context.Domain = this.Domain; context.DomainAuthSecretArn = this.DomainAuthSecretArn; if (this.DomainDnsIp != null) { context.DomainDnsIp = new List(this.DomainDnsIp); } context.DomainFqdn = this.DomainFqdn; context.DomainIAMRoleName = this.DomainIAMRoleName; context.DomainOu = this.DomainOu; if (this.EnableCloudwatchLogsExport != null) { context.EnableCloudwatchLogsExport = new List(this.EnableCloudwatchLogsExport); } context.EnableCustomerOwnedIp = this.EnableCustomerOwnedIp; context.EnableIAMDatabaseAuthentication = this.EnableIAMDatabaseAuthentication; context.Engine = this.Engine; context.Iops = this.Iops; context.LicenseModel = this.LicenseModel; context.MultiAZ = this.MultiAZ; context.NetworkType = this.NetworkType; context.OptionGroupName = this.OptionGroupName; context.Port = this.Port; if (this.ProcessorFeature != null) { context.ProcessorFeature = new List(this.ProcessorFeature); } context.PubliclyAccessible = this.PubliclyAccessible; context.StorageThroughput = this.StorageThroughput; context.StorageType = this.StorageType; if (this.Tag != null) { context.Tag = new List(this.Tag); } context.TdeCredentialArn = this.TdeCredentialArn; context.TdeCredentialPassword = this.TdeCredentialPassword; context.UseDefaultProcessorFeature = this.UseDefaultProcessorFeature; if (this.VpcSecurityGroupId != null) { context.VpcSecurityGroupId = new List(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.RestoreDBInstanceFromDBSnapshotRequest(); 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.BackupTarget != null) { request.BackupTarget = cmdletContext.BackupTarget; } if (cmdletContext.CopyTagsToSnapshot != null) { request.CopyTagsToSnapshot = cmdletContext.CopyTagsToSnapshot.Value; } if (cmdletContext.CustomIamInstanceProfile != null) { request.CustomIamInstanceProfile = cmdletContext.CustomIamInstanceProfile; } if (cmdletContext.DBClusterSnapshotIdentifier != null) { request.DBClusterSnapshotIdentifier = cmdletContext.DBClusterSnapshotIdentifier; } 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.DBSnapshotIdentifier != null) { request.DBSnapshotIdentifier = cmdletContext.DBSnapshotIdentifier; } if (cmdletContext.DBSubnetGroupName != null) { request.DBSubnetGroupName = cmdletContext.DBSubnetGroupName; } if (cmdletContext.DeletionProtection != null) { request.DeletionProtection = cmdletContext.DeletionProtection.Value; } if (cmdletContext.Domain != null) { request.Domain = cmdletContext.Domain; } if (cmdletContext.DomainAuthSecretArn != null) { request.DomainAuthSecretArn = cmdletContext.DomainAuthSecretArn; } if (cmdletContext.DomainDnsIp != null) { request.DomainDnsIps = cmdletContext.DomainDnsIp; } if (cmdletContext.DomainFqdn != null) { request.DomainFqdn = cmdletContext.DomainFqdn; } if (cmdletContext.DomainIAMRoleName != null) { request.DomainIAMRoleName = cmdletContext.DomainIAMRoleName; } if (cmdletContext.DomainOu != null) { request.DomainOu = cmdletContext.DomainOu; } if (cmdletContext.EnableCloudwatchLogsExport != null) { request.EnableCloudwatchLogsExports = cmdletContext.EnableCloudwatchLogsExport; } if (cmdletContext.EnableCustomerOwnedIp != null) { request.EnableCustomerOwnedIp = cmdletContext.EnableCustomerOwnedIp.Value; } if (cmdletContext.EnableIAMDatabaseAuthentication != null) { request.EnableIAMDatabaseAuthentication = cmdletContext.EnableIAMDatabaseAuthentication.Value; } if (cmdletContext.Engine != null) { request.Engine = cmdletContext.Engine; } if (cmdletContext.Iops != null) { request.Iops = cmdletContext.Iops.Value; } if (cmdletContext.LicenseModel != null) { request.LicenseModel = cmdletContext.LicenseModel; } if (cmdletContext.MultiAZ != null) { request.MultiAZ = cmdletContext.MultiAZ.Value; } if (cmdletContext.NetworkType != null) { request.NetworkType = cmdletContext.NetworkType; } if (cmdletContext.OptionGroupName != null) { request.OptionGroupName = cmdletContext.OptionGroupName; } if (cmdletContext.Port != null) { request.Port = cmdletContext.Port.Value; } if (cmdletContext.ProcessorFeature != null) { request.ProcessorFeatures = cmdletContext.ProcessorFeature; } if (cmdletContext.PubliclyAccessible != null) { request.PubliclyAccessible = cmdletContext.PubliclyAccessible.Value; } if (cmdletContext.StorageThroughput != null) { request.StorageThroughput = cmdletContext.StorageThroughput.Value; } if (cmdletContext.StorageType != null) { request.StorageType = cmdletContext.StorageType; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.TdeCredentialArn != null) { request.TdeCredentialArn = cmdletContext.TdeCredentialArn; } if (cmdletContext.TdeCredentialPassword != null) { request.TdeCredentialPassword = cmdletContext.TdeCredentialPassword; } 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() { return new CmdletContext(); } #endregion #region AWS Service Operation Call private Amazon.RDS.Model.RestoreDBInstanceFromDBSnapshotResponse CallAWSServiceOperation(IAmazonRDS client, Amazon.RDS.Model.RestoreDBInstanceFromDBSnapshotRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Relational Database Service", "RestoreDBInstanceFromDBSnapshot"); try { #if DESKTOP return client.RestoreDBInstanceFromDBSnapshot(request); #elif CORECLR return client.RestoreDBInstanceFromDBSnapshotAsync(request).GetAwaiter().GetResult(); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } } #endregion internal partial class CmdletContext : ExecutorContext { public System.Int32? AllocatedStorage { get; set; } public System.Boolean? AutoMinorVersionUpgrade { get; set; } public System.String AvailabilityZone { get; set; } public System.String BackupTarget { get; set; } public System.Boolean? CopyTagsToSnapshot { get; set; } public System.String CustomIamInstanceProfile { get; set; } public System.String DBClusterSnapshotIdentifier { get; set; } public System.String DBInstanceClass { get; set; } public System.String DBInstanceIdentifier { get; set; } public System.String DBName { get; set; } public System.String DBParameterGroupName { get; set; } public System.String DBSnapshotIdentifier { get; set; } public System.String DBSubnetGroupName { get; set; } public System.Boolean? DeletionProtection { get; set; } public System.String Domain { get; set; } public System.String DomainAuthSecretArn { get; set; } public List DomainDnsIp { get; set; } public System.String DomainFqdn { get; set; } public System.String DomainIAMRoleName { get; set; } public System.String DomainOu { get; set; } public List EnableCloudwatchLogsExport { get; set; } public System.Boolean? EnableCustomerOwnedIp { get; set; } public System.Boolean? EnableIAMDatabaseAuthentication { get; set; } public System.String Engine { get; set; } public System.Int32? Iops { get; set; } public System.String LicenseModel { get; set; } public System.Boolean? MultiAZ { get; set; } public System.String NetworkType { get; set; } public System.String OptionGroupName { get; set; } public System.Int32? Port { get; set; } public List ProcessorFeature { get; set; } public System.Boolean? PubliclyAccessible { get; set; } public System.Int32? StorageThroughput { get; set; } public System.String StorageType { get; set; } public List Tag { get; set; } public System.String TdeCredentialArn { get; set; } public System.String TdeCredentialPassword { get; set; } public System.Boolean? UseDefaultProcessorFeature { get; set; } public List VpcSecurityGroupId { get; set; } public System.Func Select { get; set; } = (response, cmdlet) => response.DBInstance; } } }