public void GetProducts_InvalidParameterExceptionMarshallTest() { var operation = service_model.FindOperation("GetProducts"); var request = InstantiateClassGenerator.Execute <GetProductsRequest>(); var marshaller = new GetProductsRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson <GetProductsRequest>(request, jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("InvalidParameterException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { { "x-amzn-RequestId", Guid.NewGuid().ToString() }, { "x-amz-crc32", "0" }, { "x-amzn-ErrorType", "InvalidParameterException" }, { "Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString() } } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = GetProductsResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
public void GetProductsMarshallTest() { var request = InstantiateClassGenerator.Execute <GetProductsRequest>(); var marshaller = new GetProductsRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson <GetProductsRequest>(request, jsonRequest); var webResponse = new WebResponseData { Headers = { { "x-amzn-RequestId", Guid.NewGuid().ToString() }, { "x-amz-crc32", "0" } } }; var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation("GetProducts").ResponseStructure).Execute(); webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()); UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse); var response = GetProductsResponseUnmarshaller.Instance.Unmarshall(context) as GetProductsResponse; InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
/// <summary> /// Returns a list of all products that match the filter criteria. /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetProducts service method.</param> /// /// <returns>The response from the GetProducts service method, as returned by Pricing.</returns> /// <exception cref="Amazon.Pricing.Model.ExpiredNextTokenException"> /// The pagination token expired. Try again without a pagination token. /// </exception> /// <exception cref="Amazon.Pricing.Model.InternalErrorException"> /// An error on the server occurred during the processing of your request. Try again later. /// </exception> /// <exception cref="Amazon.Pricing.Model.InvalidNextTokenException"> /// The pagination token is invalid. Try again without a pagination token. /// </exception> /// <exception cref="Amazon.Pricing.Model.InvalidParameterException"> /// One or more parameters had an invalid value. /// </exception> /// <exception cref="Amazon.Pricing.Model.NotFoundException"> /// The requested resource can't be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pricing-2017-10-15/GetProducts">REST API Reference for GetProducts Operation</seealso> public virtual GetProductsResponse GetProducts(GetProductsRequest request) { var marshaller = new GetProductsRequestMarshaller(); var unmarshaller = GetProductsResponseUnmarshaller.Instance; return(Invoke <GetProductsRequest, GetProductsResponse>(request, marshaller, unmarshaller)); }
/// <summary> /// Initiates the asynchronous execution of the GetProducts operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetProducts 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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pricing-2017-10-15/GetProducts">REST API Reference for GetProducts Operation</seealso> public virtual Task <GetProductsResponse> GetProductsAsync(GetProductsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetProductsRequestMarshaller(); var unmarshaller = GetProductsResponseUnmarshaller.Instance; return(InvokeAsync <GetProductsRequest, GetProductsResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/// <summary> /// Initiates the asynchronous execution of the GetProducts operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetProducts operation on AmazonPricingClient.</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 EndGetProducts /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pricing-2017-10-15/GetProducts">REST API Reference for GetProducts Operation</seealso> public virtual IAsyncResult BeginGetProducts(GetProductsRequest request, AsyncCallback callback, object state) { var marshaller = new GetProductsRequestMarshaller(); var unmarshaller = GetProductsResponseUnmarshaller.Instance; return(BeginInvoke <GetProductsRequest>(request, marshaller, unmarshaller, callback, state)); }