public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.FSx.Model.CreateFileSystemFromBackupRequest(); if (cmdletContext.BackupId != null) { request.BackupId = cmdletContext.BackupId; } if (cmdletContext.ClientRequestToken != null) { request.ClientRequestToken = cmdletContext.ClientRequestToken; } if (cmdletContext.SecurityGroupId != null) { request.SecurityGroupIds = cmdletContext.SecurityGroupId; } if (cmdletContext.StorageType != null) { request.StorageType = cmdletContext.StorageType; } if (cmdletContext.SubnetId != null) { request.SubnetIds = cmdletContext.SubnetId; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.WindowsConfiguration != null) { request.WindowsConfiguration = cmdletContext.WindowsConfiguration; } 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); }
private Amazon.FSx.Model.CreateFileSystemFromBackupResponse CallAWSServiceOperation(IAmazonFSx client, Amazon.FSx.Model.CreateFileSystemFromBackupRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon FSx", "CreateFileSystemFromBackup"); try { #if DESKTOP return(client.CreateFileSystemFromBackup(request)); #elif CORECLR return(client.CreateFileSystemFromBackupAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.FSx.Model.CreateFileSystemFromBackupRequest(); if (cmdletContext.BackupId != null) { request.BackupId = cmdletContext.BackupId; } if (cmdletContext.ClientRequestToken != null) { request.ClientRequestToken = cmdletContext.ClientRequestToken; } if (cmdletContext.FileSystemTypeVersion != null) { request.FileSystemTypeVersion = cmdletContext.FileSystemTypeVersion; } if (cmdletContext.KmsKeyId != null) { request.KmsKeyId = cmdletContext.KmsKeyId; } if (cmdletContext.LustreConfiguration != null) { request.LustreConfiguration = cmdletContext.LustreConfiguration; } // populate OpenZFSConfiguration var requestOpenZFSConfigurationIsNull = true; request.OpenZFSConfiguration = new Amazon.FSx.Model.CreateFileSystemOpenZFSConfiguration(); System.Int32?requestOpenZFSConfiguration_openZFSConfiguration_AutomaticBackupRetentionDay = null; if (cmdletContext.OpenZFSConfiguration_AutomaticBackupRetentionDay != null) { requestOpenZFSConfiguration_openZFSConfiguration_AutomaticBackupRetentionDay = cmdletContext.OpenZFSConfiguration_AutomaticBackupRetentionDay.Value; } if (requestOpenZFSConfiguration_openZFSConfiguration_AutomaticBackupRetentionDay != null) { request.OpenZFSConfiguration.AutomaticBackupRetentionDays = requestOpenZFSConfiguration_openZFSConfiguration_AutomaticBackupRetentionDay.Value; requestOpenZFSConfigurationIsNull = false; } System.Boolean?requestOpenZFSConfiguration_openZFSConfiguration_CopyTagsToBackup = null; if (cmdletContext.OpenZFSConfiguration_CopyTagsToBackup != null) { requestOpenZFSConfiguration_openZFSConfiguration_CopyTagsToBackup = cmdletContext.OpenZFSConfiguration_CopyTagsToBackup.Value; } if (requestOpenZFSConfiguration_openZFSConfiguration_CopyTagsToBackup != null) { request.OpenZFSConfiguration.CopyTagsToBackups = requestOpenZFSConfiguration_openZFSConfiguration_CopyTagsToBackup.Value; requestOpenZFSConfigurationIsNull = false; } System.Boolean?requestOpenZFSConfiguration_openZFSConfiguration_CopyTagsToVolume = null; if (cmdletContext.OpenZFSConfiguration_CopyTagsToVolume != null) { requestOpenZFSConfiguration_openZFSConfiguration_CopyTagsToVolume = cmdletContext.OpenZFSConfiguration_CopyTagsToVolume.Value; } if (requestOpenZFSConfiguration_openZFSConfiguration_CopyTagsToVolume != null) { request.OpenZFSConfiguration.CopyTagsToVolumes = requestOpenZFSConfiguration_openZFSConfiguration_CopyTagsToVolume.Value; requestOpenZFSConfigurationIsNull = false; } System.String requestOpenZFSConfiguration_openZFSConfiguration_DailyAutomaticBackupStartTime = null; if (cmdletContext.OpenZFSConfiguration_DailyAutomaticBackupStartTime != null) { requestOpenZFSConfiguration_openZFSConfiguration_DailyAutomaticBackupStartTime = cmdletContext.OpenZFSConfiguration_DailyAutomaticBackupStartTime; } if (requestOpenZFSConfiguration_openZFSConfiguration_DailyAutomaticBackupStartTime != null) { request.OpenZFSConfiguration.DailyAutomaticBackupStartTime = requestOpenZFSConfiguration_openZFSConfiguration_DailyAutomaticBackupStartTime; requestOpenZFSConfigurationIsNull = false; } Amazon.FSx.OpenZFSDeploymentType requestOpenZFSConfiguration_openZFSConfiguration_DeploymentType = null; if (cmdletContext.OpenZFSConfiguration_DeploymentType != null) { requestOpenZFSConfiguration_openZFSConfiguration_DeploymentType = cmdletContext.OpenZFSConfiguration_DeploymentType; } if (requestOpenZFSConfiguration_openZFSConfiguration_DeploymentType != null) { request.OpenZFSConfiguration.DeploymentType = requestOpenZFSConfiguration_openZFSConfiguration_DeploymentType; requestOpenZFSConfigurationIsNull = false; } System.Int32?requestOpenZFSConfiguration_openZFSConfiguration_ThroughputCapacity = null; if (cmdletContext.OpenZFSConfiguration_ThroughputCapacity != null) { requestOpenZFSConfiguration_openZFSConfiguration_ThroughputCapacity = cmdletContext.OpenZFSConfiguration_ThroughputCapacity.Value; } if (requestOpenZFSConfiguration_openZFSConfiguration_ThroughputCapacity != null) { request.OpenZFSConfiguration.ThroughputCapacity = requestOpenZFSConfiguration_openZFSConfiguration_ThroughputCapacity.Value; requestOpenZFSConfigurationIsNull = false; } System.String requestOpenZFSConfiguration_openZFSConfiguration_WeeklyMaintenanceStartTime = null; if (cmdletContext.OpenZFSConfiguration_WeeklyMaintenanceStartTime != null) { requestOpenZFSConfiguration_openZFSConfiguration_WeeklyMaintenanceStartTime = cmdletContext.OpenZFSConfiguration_WeeklyMaintenanceStartTime; } if (requestOpenZFSConfiguration_openZFSConfiguration_WeeklyMaintenanceStartTime != null) { request.OpenZFSConfiguration.WeeklyMaintenanceStartTime = requestOpenZFSConfiguration_openZFSConfiguration_WeeklyMaintenanceStartTime; requestOpenZFSConfigurationIsNull = false; } Amazon.FSx.Model.DiskIopsConfiguration requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration = null; // populate DiskIopsConfiguration var requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfigurationIsNull = true; requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration = new Amazon.FSx.Model.DiskIopsConfiguration(); System.Int64?requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration_diskIopsConfiguration_Iops = null; if (cmdletContext.DiskIopsConfiguration_Iops != null) { requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration_diskIopsConfiguration_Iops = cmdletContext.DiskIopsConfiguration_Iops.Value; } if (requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration_diskIopsConfiguration_Iops != null) { requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration.Iops = requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration_diskIopsConfiguration_Iops.Value; requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfigurationIsNull = false; } Amazon.FSx.DiskIopsConfigurationMode requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration_diskIopsConfiguration_Mode = null; if (cmdletContext.DiskIopsConfiguration_Mode != null) { requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration_diskIopsConfiguration_Mode = cmdletContext.DiskIopsConfiguration_Mode; } if (requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration_diskIopsConfiguration_Mode != null) { requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration.Mode = requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration_diskIopsConfiguration_Mode; requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfigurationIsNull = false; } // determine if requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration should be set to null if (requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfigurationIsNull) { requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration = null; } if (requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration != null) { request.OpenZFSConfiguration.DiskIopsConfiguration = requestOpenZFSConfiguration_openZFSConfiguration_DiskIopsConfiguration; requestOpenZFSConfigurationIsNull = false; } Amazon.FSx.Model.OpenZFSCreateRootVolumeConfiguration requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration = null; // populate RootVolumeConfiguration var requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfigurationIsNull = true; requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration = new Amazon.FSx.Model.OpenZFSCreateRootVolumeConfiguration(); System.Boolean?requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_CopyTagsToSnapshot = null; if (cmdletContext.RootVolumeConfiguration_CopyTagsToSnapshot != null) { requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_CopyTagsToSnapshot = cmdletContext.RootVolumeConfiguration_CopyTagsToSnapshot.Value; } if (requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_CopyTagsToSnapshot != null) { requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration.CopyTagsToSnapshots = requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_CopyTagsToSnapshot.Value; requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfigurationIsNull = false; } Amazon.FSx.OpenZFSDataCompressionType requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_DataCompressionType = null; if (cmdletContext.RootVolumeConfiguration_DataCompressionType != null) { requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_DataCompressionType = cmdletContext.RootVolumeConfiguration_DataCompressionType; } if (requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_DataCompressionType != null) { requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration.DataCompressionType = requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_DataCompressionType; requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfigurationIsNull = false; } List <Amazon.FSx.Model.OpenZFSNfsExport> requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_NfsExport = null; if (cmdletContext.RootVolumeConfiguration_NfsExport != null) { requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_NfsExport = cmdletContext.RootVolumeConfiguration_NfsExport; } if (requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_NfsExport != null) { requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration.NfsExports = requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_NfsExport; requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfigurationIsNull = false; } System.Boolean?requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_ReadOnly = null; if (cmdletContext.RootVolumeConfiguration_ReadOnly != null) { requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_ReadOnly = cmdletContext.RootVolumeConfiguration_ReadOnly.Value; } if (requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_ReadOnly != null) { requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration.ReadOnly = requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_ReadOnly.Value; requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfigurationIsNull = false; } List <Amazon.FSx.Model.OpenZFSUserOrGroupQuota> requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_UserAndGroupQuota = null; if (cmdletContext.RootVolumeConfiguration_UserAndGroupQuota != null) { requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_UserAndGroupQuota = cmdletContext.RootVolumeConfiguration_UserAndGroupQuota; } if (requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_UserAndGroupQuota != null) { requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration.UserAndGroupQuotas = requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration_rootVolumeConfiguration_UserAndGroupQuota; requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfigurationIsNull = false; } // determine if requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration should be set to null if (requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfigurationIsNull) { requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration = null; } if (requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration != null) { request.OpenZFSConfiguration.RootVolumeConfiguration = requestOpenZFSConfiguration_openZFSConfiguration_RootVolumeConfiguration; requestOpenZFSConfigurationIsNull = false; } // determine if request.OpenZFSConfiguration should be set to null if (requestOpenZFSConfigurationIsNull) { request.OpenZFSConfiguration = null; } if (cmdletContext.SecurityGroupId != null) { request.SecurityGroupIds = cmdletContext.SecurityGroupId; } if (cmdletContext.StorageType != null) { request.StorageType = cmdletContext.StorageType; } if (cmdletContext.SubnetId != null) { request.SubnetIds = cmdletContext.SubnetId; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.WindowsConfiguration != null) { request.WindowsConfiguration = cmdletContext.WindowsConfiguration; } 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); }