public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CloudHSMV2.Model.CreateClusterRequest();

            if (cmdletContext.HsmType != null)
            {
                request.HsmType = cmdletContext.HsmType;
            }
            if (cmdletContext.SourceBackupId != null)
            {
                request.SourceBackupId = cmdletContext.SourceBackupId;
            }
            if (cmdletContext.SubnetId != null)
            {
                request.SubnetIds = cmdletContext.SubnetId;
            }
            if (cmdletContext.TagList != null)
            {
                request.TagList = cmdletContext.TagList;
            }

            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.CloudHSMV2.Model.CreateClusterResponse CallAWSServiceOperation(IAmazonCloudHSMV2 client, Amazon.CloudHSMV2.Model.CreateClusterRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CloudHSM V2", "CreateCluster");
     try
     {
         #if DESKTOP
         return(client.CreateCluster(request));
         #elif CORECLR
         return(client.CreateClusterAsync(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.CloudHSMV2.Model.CreateClusterRequest();


            // populate BackupRetentionPolicy
            var requestBackupRetentionPolicyIsNull = true;

            request.BackupRetentionPolicy = new Amazon.CloudHSMV2.Model.BackupRetentionPolicy();
            Amazon.CloudHSMV2.BackupRetentionType requestBackupRetentionPolicy_backupRetentionPolicy_Type = null;
            if (cmdletContext.BackupRetentionPolicy_Type != null)
            {
                requestBackupRetentionPolicy_backupRetentionPolicy_Type = cmdletContext.BackupRetentionPolicy_Type;
            }
            if (requestBackupRetentionPolicy_backupRetentionPolicy_Type != null)
            {
                request.BackupRetentionPolicy.Type = requestBackupRetentionPolicy_backupRetentionPolicy_Type;
                requestBackupRetentionPolicyIsNull = false;
            }
            System.String requestBackupRetentionPolicy_backupRetentionPolicy_Value = null;
            if (cmdletContext.BackupRetentionPolicy_Value != null)
            {
                requestBackupRetentionPolicy_backupRetentionPolicy_Value = cmdletContext.BackupRetentionPolicy_Value;
            }
            if (requestBackupRetentionPolicy_backupRetentionPolicy_Value != null)
            {
                request.BackupRetentionPolicy.Value = requestBackupRetentionPolicy_backupRetentionPolicy_Value;
                requestBackupRetentionPolicyIsNull  = false;
            }
            // determine if request.BackupRetentionPolicy should be set to null
            if (requestBackupRetentionPolicyIsNull)
            {
                request.BackupRetentionPolicy = null;
            }
            if (cmdletContext.HsmType != null)
            {
                request.HsmType = cmdletContext.HsmType;
            }
            if (cmdletContext.SourceBackupId != null)
            {
                request.SourceBackupId = cmdletContext.SourceBackupId;
            }
            if (cmdletContext.SubnetId != null)
            {
                request.SubnetIds = cmdletContext.SubnetId;
            }
            if (cmdletContext.TagList != null)
            {
                request.TagList = cmdletContext.TagList;
            }

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