예제 #1
0
        internal InvokeResponse Invoke(InvokeRequest request)
        {
            var marshaller   = new InvokeRequestMarshaller();
            var unmarshaller = InvokeResponseUnmarshaller.Instance;

            return(Invoke <InvokeRequest, InvokeResponse>(request, marshaller, unmarshaller));
        }
        public void InvokeMarshallTest()
        {
            var operation = service_model.FindOperation("Invoke");

            var request    = InstantiateClassGenerator.Execute <InvokeRequest>();
            var marshaller = new InvokeRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);

            RequestValidator.Validate("Invoke", request, internalRequest, service_model);

            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "X-Amz-Function-Error", "X-Amz-Function-Error_Value" },
                    { "X-Amz-Log-Result",     "X-Amz-Log-Result_Value"     },
                    { "x-amzn-RequestId",     Guid.NewGuid().ToString()    },
                    { "x-amz-crc32",          "0"                          }
                }
            };

            var payloadResponse = new JsonSampleGenerator(service_model, operation.ResponseStructure).Execute();

            webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString());
            var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, webResponse);
            ResponseUnmarshaller unmarshaller = InvokeResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                           as InvokeResponse;

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
예제 #3
0
        /// <summary>
        /// Initiates the asynchronous execution of the Invoke operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the Invoke operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <InvokeResponse> InvokeAsync(InvokeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new InvokeRequestMarshaller();
            var unmarshaller = InvokeResponseUnmarshaller.Instance;

            return(InvokeAsync <InvokeRequest, InvokeResponse>(request, marshaller,
                                                               unmarshaller, cancellationToken));
        }
예제 #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the Invoke operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the Invoke operation on AmazonLambdaClient.</param>
        /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
        /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        public void InvokeAsync(InvokeRequest request, AmazonServiceCallback <InvokeRequest, InvokeResponse> callback, AsyncOptions options = null)
        {
            options = options == null?new AsyncOptions():options;
            var marshaller   = new InvokeRequestMarshaller();
            var unmarshaller = InvokeResponseUnmarshaller.Instance;
            Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;

            if (callback != null)
            {
                callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => {
                    AmazonServiceResult <InvokeRequest, InvokeResponse> responseObject
                        = new AmazonServiceResult <InvokeRequest, InvokeResponse>((InvokeRequest)req, (InvokeResponse)res, ex, ao.State);
                    callback(responseObject);
                }
            }
            ;
            BeginInvoke <InvokeRequest>(request, marshaller, unmarshaller, options, callbackHelper);
        }
예제 #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the Invoke operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the Invoke operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<InvokeResponse> InvokeAsync(InvokeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new InvokeRequestMarshaller();
            var unmarshaller = InvokeResponseUnmarshaller.Instance;

            return InvokeAsync<InvokeRequest,InvokeResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
예제 #6
0
        internal InvokeResponse Invoke(InvokeRequest request)
        {
            var marshaller = new InvokeRequestMarshaller();
            var unmarshaller = InvokeResponseUnmarshaller.Instance;

            return Invoke<InvokeRequest,InvokeResponse>(request, marshaller, unmarshaller);
        }
        public void InvokeMarshallTest()
        {
            var operation = service_model.FindOperation("Invoke");

            var request = InstantiateClassGenerator.Execute<InvokeRequest>();
            var marshaller = new InvokeRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);
            RequestValidator.Validate("Invoke", request, internalRequest, service_model);            

            var webResponse = new WebResponseData
            {
                Headers = {
                    {"X-Amz-Function-Error","X-Amz-Function-Error_Value"},
                    {"X-Amz-Log-Result","X-Amz-Log-Result_Value"},
                    {"x-amzn-RequestId", Guid.NewGuid().ToString()},
                    {"x-amz-crc32","0"}
                }
            };

            var payloadResponse = new JsonSampleGenerator(service_model, operation.ResponseStructure).Execute();
            webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString());
            var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, webResponse);
            ResponseUnmarshaller unmarshaller = InvokeResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                as InvokeResponse;   
            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);               
        }
예제 #8
0
        /// <summary>
        /// Initiates the asynchronous execution of the Invoke operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the Invoke operation on AmazonLambdaClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndInvoke
        ///         operation.</returns>
        public IAsyncResult BeginInvoke(InvokeRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new InvokeRequestMarshaller();
            var unmarshaller = InvokeResponseUnmarshaller.Instance;

            return BeginInvoke<InvokeRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
예제 #9
0
 /// <summary>
 /// Initiates the asynchronous execution of the Invoke operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the Invoke operation on AmazonLambdaClient.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void InvokeAsync(InvokeRequest request, AmazonServiceCallback<InvokeRequest, InvokeResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new InvokeRequestMarshaller();
     var unmarshaller = InvokeResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<InvokeRequest,InvokeResponse> responseObject 
                     = new AmazonServiceResult<InvokeRequest,InvokeResponse>((InvokeRequest)req, (InvokeResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<InvokeRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }