private Amazon.IoT.Model.StartAuditMitigationActionsTaskResponse CallAWSServiceOperation(IAmazonIoT client, Amazon.IoT.Model.StartAuditMitigationActionsTaskRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT", "StartAuditMitigationActionsTask");
     try
     {
         #if DESKTOP
         return(client.StartAuditMitigationActionsTask(request));
         #elif CORECLR
         return(client.StartAuditMitigationActionsTaskAsync(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.IoT.Model.StartAuditMitigationActionsTaskRequest();

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

            // populate Target
            var requestTargetIsNull = true;

            request.Target = new Amazon.IoT.Model.AuditMitigationActionsTaskTarget();
            Dictionary <System.String, List <System.String> > requestTarget_target_AuditCheckToReasonCodeFilter = null;

            if (cmdletContext.Target_AuditCheckToReasonCodeFilter != null)
            {
                requestTarget_target_AuditCheckToReasonCodeFilter = cmdletContext.Target_AuditCheckToReasonCodeFilter;
            }
            if (requestTarget_target_AuditCheckToReasonCodeFilter != null)
            {
                request.Target.AuditCheckToReasonCodeFilter = requestTarget_target_AuditCheckToReasonCodeFilter;
                requestTargetIsNull = false;
            }
            System.String requestTarget_target_AuditTaskId = null;
            if (cmdletContext.Target_AuditTaskId != null)
            {
                requestTarget_target_AuditTaskId = cmdletContext.Target_AuditTaskId;
            }
            if (requestTarget_target_AuditTaskId != null)
            {
                request.Target.AuditTaskId = requestTarget_target_AuditTaskId;
                requestTargetIsNull        = false;
            }
            List <System.String> requestTarget_target_FindingId = null;

            if (cmdletContext.Target_FindingId != null)
            {
                requestTarget_target_FindingId = cmdletContext.Target_FindingId;
            }
            if (requestTarget_target_FindingId != null)
            {
                request.Target.FindingIds = requestTarget_target_FindingId;
                requestTargetIsNull       = false;
            }
            // determine if request.Target should be set to null
            if (requestTargetIsNull)
            {
                request.Target = null;
            }
            if (cmdletContext.TaskId != null)
            {
                request.TaskId = cmdletContext.TaskId;
            }

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