private Amazon.S3.Model.SelectObjectContentResponse CallAWSServiceOperation(IAmazonS3 client, Amazon.S3.Model.SelectObjectContentRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Storage Service (S3)", "SelectObjectContent");
     try
     {
         #if DESKTOP
         return(client.SelectObjectContent(request));
         #elif CORECLR
         return(client.SelectObjectContentAsync(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.S3.Model.SelectObjectContentRequest();

            if (cmdletContext.Bucket != null)
            {
                request.Bucket = cmdletContext.Bucket;
            }
            if (cmdletContext.Key != null)
            {
                request.Key = cmdletContext.Key;
            }
            if (cmdletContext.ServerSideCustomerEncryptionMethod != null)
            {
                request.ServerSideCustomerEncryptionMethod = cmdletContext.ServerSideCustomerEncryptionMethod;
            }
            if (cmdletContext.ServerSideEncryptionCustomerProvidedKey != null)
            {
                request.ServerSideEncryptionCustomerProvidedKey = cmdletContext.ServerSideEncryptionCustomerProvidedKey;
            }
            if (cmdletContext.ServerSideEncryptionCustomerProvidedKeyMD5 != null)
            {
                request.ServerSideEncryptionCustomerProvidedKeyMD5 = cmdletContext.ServerSideEncryptionCustomerProvidedKeyMD5;
            }
            if (cmdletContext.Expression != null)
            {
                request.Expression = cmdletContext.Expression;
            }
            if (cmdletContext.ExpressionType != null)
            {
                request.ExpressionType = cmdletContext.ExpressionType;
            }
            if (cmdletContext.RequestProgress != null)
            {
                request.RequestProgress = cmdletContext.RequestProgress.Value;
            }
            if (cmdletContext.InputSerialization != null)
            {
                request.InputSerialization = cmdletContext.InputSerialization;
            }
            if (cmdletContext.OutputSerialization != null)
            {
                request.OutputSerialization = cmdletContext.OutputSerialization;
            }

            // populate ScanRange
            var requestScanRangeIsNull = true;

            request.ScanRange = new Amazon.S3.Model.ScanRange();
            System.Int64?requestScanRange_scanRange_Start = null;
            if (cmdletContext.ScanRange_Start != null)
            {
                requestScanRange_scanRange_Start = cmdletContext.ScanRange_Start.Value;
            }
            if (requestScanRange_scanRange_Start != null)
            {
                request.ScanRange.Start = requestScanRange_scanRange_Start.Value;
                requestScanRangeIsNull  = false;
            }
            System.Int64?requestScanRange_scanRange_End = null;
            if (cmdletContext.ScanRange_End != null)
            {
                requestScanRange_scanRange_End = cmdletContext.ScanRange_End.Value;
            }
            if (requestScanRange_scanRange_End != null)
            {
                request.ScanRange.End  = requestScanRange_scanRange_End.Value;
                requestScanRangeIsNull = false;
            }
            // determine if request.ScanRange should be set to null
            if (requestScanRangeIsNull)
            {
                request.ScanRange = null;
            }
            if (cmdletContext.ExpectedBucketOwner != null)
            {
                request.ExpectedBucketOwner = cmdletContext.ExpectedBucketOwner;
            }

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