private Amazon.MTurk.Model.CreateHITWithHITTypeResponse CallAWSServiceOperation(IAmazonMTurk client, Amazon.MTurk.Model.CreateHITWithHITTypeRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon MTurk Service", "CreateHITWithHITType");
     try
     {
         #if DESKTOP
         return(client.CreateHITWithHITType(request));
         #elif CORECLR
         return(client.CreateHITWithHITTypeAsync(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.MTurk.Model.CreateHITWithHITTypeRequest();


            // populate AssignmentReviewPolicy
            var requestAssignmentReviewPolicyIsNull = true;

            request.AssignmentReviewPolicy = new Amazon.MTurk.Model.ReviewPolicy();
            List <Amazon.MTurk.Model.PolicyParameter> requestAssignmentReviewPolicy_assignmentReviewPolicy_Parameter = null;

            if (cmdletContext.AssignmentReviewPolicy_Parameter != null)
            {
                requestAssignmentReviewPolicy_assignmentReviewPolicy_Parameter = cmdletContext.AssignmentReviewPolicy_Parameter;
            }
            if (requestAssignmentReviewPolicy_assignmentReviewPolicy_Parameter != null)
            {
                request.AssignmentReviewPolicy.Parameters = requestAssignmentReviewPolicy_assignmentReviewPolicy_Parameter;
                requestAssignmentReviewPolicyIsNull       = false;
            }
            System.String requestAssignmentReviewPolicy_assignmentReviewPolicy_PolicyName = null;
            if (cmdletContext.AssignmentReviewPolicy_PolicyName != null)
            {
                requestAssignmentReviewPolicy_assignmentReviewPolicy_PolicyName = cmdletContext.AssignmentReviewPolicy_PolicyName;
            }
            if (requestAssignmentReviewPolicy_assignmentReviewPolicy_PolicyName != null)
            {
                request.AssignmentReviewPolicy.PolicyName = requestAssignmentReviewPolicy_assignmentReviewPolicy_PolicyName;
                requestAssignmentReviewPolicyIsNull       = false;
            }
            // determine if request.AssignmentReviewPolicy should be set to null
            if (requestAssignmentReviewPolicyIsNull)
            {
                request.AssignmentReviewPolicy = null;
            }
            if (cmdletContext.HITLayoutId != null)
            {
                request.HITLayoutId = cmdletContext.HITLayoutId;
            }
            if (cmdletContext.HITLayoutParameter != null)
            {
                request.HITLayoutParameters = cmdletContext.HITLayoutParameter;
            }

            // populate HITReviewPolicy
            var requestHITReviewPolicyIsNull = true;

            request.HITReviewPolicy = new Amazon.MTurk.Model.ReviewPolicy();
            List <Amazon.MTurk.Model.PolicyParameter> requestHITReviewPolicy_hITReviewPolicy_Parameter = null;

            if (cmdletContext.HITReviewPolicy_Parameter != null)
            {
                requestHITReviewPolicy_hITReviewPolicy_Parameter = cmdletContext.HITReviewPolicy_Parameter;
            }
            if (requestHITReviewPolicy_hITReviewPolicy_Parameter != null)
            {
                request.HITReviewPolicy.Parameters = requestHITReviewPolicy_hITReviewPolicy_Parameter;
                requestHITReviewPolicyIsNull       = false;
            }
            System.String requestHITReviewPolicy_hITReviewPolicy_PolicyName = null;
            if (cmdletContext.HITReviewPolicy_PolicyName != null)
            {
                requestHITReviewPolicy_hITReviewPolicy_PolicyName = cmdletContext.HITReviewPolicy_PolicyName;
            }
            if (requestHITReviewPolicy_hITReviewPolicy_PolicyName != null)
            {
                request.HITReviewPolicy.PolicyName = requestHITReviewPolicy_hITReviewPolicy_PolicyName;
                requestHITReviewPolicyIsNull       = false;
            }
            // determine if request.HITReviewPolicy should be set to null
            if (requestHITReviewPolicyIsNull)
            {
                request.HITReviewPolicy = null;
            }
            if (cmdletContext.HITTypeId != null)
            {
                request.HITTypeId = cmdletContext.HITTypeId;
            }
            if (cmdletContext.LifetimeInSecond != null)
            {
                request.LifetimeInSeconds = cmdletContext.LifetimeInSecond.Value;
            }
            if (cmdletContext.MaxAssignment != null)
            {
                request.MaxAssignments = cmdletContext.MaxAssignment.Value;
            }
            if (cmdletContext.Question != null)
            {
                request.Question = cmdletContext.Question;
            }
            if (cmdletContext.RequesterAnnotation != null)
            {
                request.RequesterAnnotation = cmdletContext.RequesterAnnotation;
            }
            if (cmdletContext.UniqueRequestToken != null)
            {
                request.UniqueRequestToken = cmdletContext.UniqueRequestToken;
            }

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