private Amazon.EventBridge.Model.StartReplayResponse CallAWSServiceOperation(IAmazonEventBridge client, Amazon.EventBridge.Model.StartReplayRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon EventBridge", "StartReplay");
     try
     {
         #if DESKTOP
         return(client.StartReplay(request));
         #elif CORECLR
         return(client.StartReplayAsync(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.EventBridge.Model.StartReplayRequest();

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

            // populate Destination
            var requestDestinationIsNull = true;

            request.Destination = new Amazon.EventBridge.Model.ReplayDestination();
            System.String requestDestination_destination_Arn = null;
            if (cmdletContext.Destination_Arn != null)
            {
                requestDestination_destination_Arn = cmdletContext.Destination_Arn;
            }
            if (requestDestination_destination_Arn != null)
            {
                request.Destination.Arn  = requestDestination_destination_Arn;
                requestDestinationIsNull = false;
            }
            List <System.String> requestDestination_destination_FilterArn = null;

            if (cmdletContext.Destination_FilterArn != null)
            {
                requestDestination_destination_FilterArn = cmdletContext.Destination_FilterArn;
            }
            if (requestDestination_destination_FilterArn != null)
            {
                request.Destination.FilterArns = requestDestination_destination_FilterArn;
                requestDestinationIsNull       = false;
            }
            // determine if request.Destination should be set to null
            if (requestDestinationIsNull)
            {
                request.Destination = null;
            }
            if (cmdletContext.EventEndTime != null)
            {
                request.EventEndTime = cmdletContext.EventEndTime.Value;
            }
            if (cmdletContext.EventSourceArn != null)
            {
                request.EventSourceArn = cmdletContext.EventSourceArn;
            }
            if (cmdletContext.EventStartTime != null)
            {
                request.EventStartTime = cmdletContext.EventStartTime.Value;
            }
            if (cmdletContext.ReplayName != null)
            {
                request.ReplayName = cmdletContext.ReplayName;
            }

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