private Amazon.IoTEvents.Model.UpdateDetectorModelResponse CallAWSServiceOperation(IAmazonIoTEvents client, Amazon.IoTEvents.Model.UpdateDetectorModelRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT Events", "UpdateDetectorModel");
     try
     {
         #if DESKTOP
         return(client.UpdateDetectorModel(request));
         #elif CORECLR
         return(client.UpdateDetectorModelAsync(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.IoTEvents.Model.UpdateDetectorModelRequest();


            // populate DetectorModelDefinition
            var requestDetectorModelDefinitionIsNull = true;

            request.DetectorModelDefinition = new Amazon.IoTEvents.Model.DetectorModelDefinition();
            System.String requestDetectorModelDefinition_detectorModelDefinition_InitialStateName = null;
            if (cmdletContext.DetectorModelDefinition_InitialStateName != null)
            {
                requestDetectorModelDefinition_detectorModelDefinition_InitialStateName = cmdletContext.DetectorModelDefinition_InitialStateName;
            }
            if (requestDetectorModelDefinition_detectorModelDefinition_InitialStateName != null)
            {
                request.DetectorModelDefinition.InitialStateName = requestDetectorModelDefinition_detectorModelDefinition_InitialStateName;
                requestDetectorModelDefinitionIsNull             = false;
            }
            List <Amazon.IoTEvents.Model.State> requestDetectorModelDefinition_detectorModelDefinition_State = null;

            if (cmdletContext.DetectorModelDefinition_State != null)
            {
                requestDetectorModelDefinition_detectorModelDefinition_State = cmdletContext.DetectorModelDefinition_State;
            }
            if (requestDetectorModelDefinition_detectorModelDefinition_State != null)
            {
                request.DetectorModelDefinition.States = requestDetectorModelDefinition_detectorModelDefinition_State;
                requestDetectorModelDefinitionIsNull   = false;
            }
            // determine if request.DetectorModelDefinition should be set to null
            if (requestDetectorModelDefinitionIsNull)
            {
                request.DetectorModelDefinition = null;
            }
            if (cmdletContext.DetectorModelDescription != null)
            {
                request.DetectorModelDescription = cmdletContext.DetectorModelDescription;
            }
            if (cmdletContext.DetectorModelName != null)
            {
                request.DetectorModelName = cmdletContext.DetectorModelName;
            }
            if (cmdletContext.EvaluationMethod != null)
            {
                request.EvaluationMethod = cmdletContext.EvaluationMethod;
            }
            if (cmdletContext.RoleArn != null)
            {
                request.RoleArn = cmdletContext.RoleArn;
            }

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