コード例 #1
0
 private Amazon.FSx.Model.DeleteVolumeResponse CallAWSServiceOperation(IAmazonFSx client, Amazon.FSx.Model.DeleteVolumeRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon FSx", "DeleteVolume");
     try
     {
         #if DESKTOP
         return(client.DeleteVolume(request));
         #elif CORECLR
         return(client.DeleteVolumeAsync(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;
     }
 }
コード例 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.FSx.Model.DeleteVolumeRequest();

            if (cmdletContext.ClientRequestToken != null)
            {
                request.ClientRequestToken = cmdletContext.ClientRequestToken;
            }

            // populate OntapConfiguration
            var requestOntapConfigurationIsNull = true;

            request.OntapConfiguration = new Amazon.FSx.Model.DeleteVolumeOntapConfiguration();
            List <Amazon.FSx.Model.Tag> requestOntapConfiguration_ontapConfiguration_FinalBackupTag = null;

            if (cmdletContext.OntapConfiguration_FinalBackupTag != null)
            {
                requestOntapConfiguration_ontapConfiguration_FinalBackupTag = cmdletContext.OntapConfiguration_FinalBackupTag;
            }
            if (requestOntapConfiguration_ontapConfiguration_FinalBackupTag != null)
            {
                request.OntapConfiguration.FinalBackupTags = requestOntapConfiguration_ontapConfiguration_FinalBackupTag;
                requestOntapConfigurationIsNull            = false;
            }
            System.Boolean?requestOntapConfiguration_ontapConfiguration_SkipFinalBackup = null;
            if (cmdletContext.OntapConfiguration_SkipFinalBackup != null)
            {
                requestOntapConfiguration_ontapConfiguration_SkipFinalBackup = cmdletContext.OntapConfiguration_SkipFinalBackup.Value;
            }
            if (requestOntapConfiguration_ontapConfiguration_SkipFinalBackup != null)
            {
                request.OntapConfiguration.SkipFinalBackup = requestOntapConfiguration_ontapConfiguration_SkipFinalBackup.Value;
                requestOntapConfigurationIsNull            = false;
            }
            // determine if request.OntapConfiguration should be set to null
            if (requestOntapConfigurationIsNull)
            {
                request.OntapConfiguration = null;
            }

            // populate OpenZFSConfiguration
            var requestOpenZFSConfigurationIsNull = true;

            request.OpenZFSConfiguration = new Amazon.FSx.Model.DeleteVolumeOpenZFSConfiguration();
            List <System.String> requestOpenZFSConfiguration_openZFSConfiguration_Option = null;

            if (cmdletContext.OpenZFSConfiguration_Option != null)
            {
                requestOpenZFSConfiguration_openZFSConfiguration_Option = cmdletContext.OpenZFSConfiguration_Option;
            }
            if (requestOpenZFSConfiguration_openZFSConfiguration_Option != null)
            {
                request.OpenZFSConfiguration.Options = requestOpenZFSConfiguration_openZFSConfiguration_Option;
                requestOpenZFSConfigurationIsNull    = false;
            }
            // determine if request.OpenZFSConfiguration should be set to null
            if (requestOpenZFSConfigurationIsNull)
            {
                request.OpenZFSConfiguration = null;
            }
            if (cmdletContext.VolumeId != null)
            {
                request.VolumeId = cmdletContext.VolumeId;
            }

            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);
        }