protected IAsyncResult BeginInvoke(AmazonWebServiceRequest request, InvokeOptionsBase options, AsyncCallback callback, object state) { ThrowIfDisposed(); var executionContext = new AsyncExecutionContext( new AsyncRequestContext(this.Config.LogMetrics, Signer) { ClientConfig = this.Config, Marshaller = options.RequestMarshaller, OriginalRequest = request, Unmarshaller = options.ResponseUnmarshaller, Callback = callback, State = state, IsAsync = true, ServiceMetaData = this.ServiceMetadata, Options = options }, new AsyncResponseContext() ); SetupCSMHandler(executionContext.RequestContext); var asyncResult = this.RuntimePipeline.InvokeAsync(executionContext); return(asyncResult); }
protected System.Threading.Tasks.Task <TResponse> InvokeAsync <TResponse>( AmazonWebServiceRequest request, InvokeOptionsBase options, System.Threading.CancellationToken cancellationToken) where TResponse : AmazonWebServiceResponse, new() { ThrowIfDisposed(); #if AWS_ASYNC_API if (cancellationToken == default(CancellationToken)) { cancellationToken = _config.BuildDefaultCancellationToken(); } #endif var executionContext = new ExecutionContext( new RequestContext(this.Config.LogMetrics, Signer) { ClientConfig = this.Config, Marshaller = options.RequestMarshaller, OriginalRequest = request, Unmarshaller = options.ResponseUnmarshaller, IsAsync = true, CancellationToken = cancellationToken, ServiceMetaData = this.ServiceMetadata, Options = options }, new ResponseContext() ); SetupCSMHandler(executionContext.RequestContext); return(this.RuntimePipeline.InvokeAsync <TResponse>(executionContext)); }
protected TResponse Invoke <TResponse>(AmazonWebServiceRequest request, InvokeOptionsBase options) where TResponse : AmazonWebServiceResponse { ThrowIfDisposed(); var executionContext = new ExecutionContext( new RequestContext(this.Config.LogMetrics, Signer) { ClientConfig = this.Config, Marshaller = options.RequestMarshaller, OriginalRequest = request, Unmarshaller = options.ResponseUnmarshaller, IsAsync = false, ServiceMetaData = this.ServiceMetadata, Options = options }, new ResponseContext() ); SetupCSMHandler(executionContext.RequestContext); var response = (TResponse)this.RuntimePipeline.InvokeSync(executionContext).Response; return(response); }
protected IAsyncResult BeginInvoke(AmazonWebServiceRequest request, InvokeOptionsBase options, AsyncOptions asyncOptions, Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper) { ThrowIfDisposed(); asyncOptions = asyncOptions ?? new AsyncOptions(); var executionContext = new AsyncExecutionContext( new AsyncRequestContext(this.Config.LogMetrics, Signer) { ClientConfig = this.Config, Marshaller = options.RequestMarshaller, OriginalRequest = request, Unmarshaller = options.ResponseUnmarshaller, Action = callbackHelper, AsyncOptions = asyncOptions, IsAsync = true, ServiceMetaData = this.ServiceMetadata, Options = options }, new AsyncResponseContext() ); return(this.RuntimePipeline.InvokeAsync(executionContext)); }