public void MeterUsageMarshallTest()
        {
            var request    = InstantiateClassGenerator.Execute <MeterUsageRequest>();
            var marshaller = new MeterUsageRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);
            var jsonRequest     = UTF8Encoding.UTF8.GetString(internalRequest.Content);

            Comparer.CompareObjectToJson <MeterUsageRequest>(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("MeterUsage").ResponseStructure).Execute();

            webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString());
            UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse);
            var response = MeterUsageResponseUnmarshaller.Instance.Unmarshall(context)
                           as MeterUsageResponse;

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
        internal virtual MeterUsageResponse MeterUsage(MeterUsageRequest request)
        {
            var marshaller   = new MeterUsageRequestMarshaller();
            var unmarshaller = MeterUsageResponseUnmarshaller.Instance;

            return(Invoke <MeterUsageRequest, MeterUsageResponse>(request, marshaller, unmarshaller));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the MeterUsage operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the MeterUsage 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/meteringmarketplace-2016-01-14/MeterUsage">REST API Reference for MeterUsage Operation</seealso>
        public virtual Task <MeterUsageResponse> MeterUsageAsync(MeterUsageRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new MeterUsageRequestMarshaller();
            var unmarshaller = MeterUsageResponseUnmarshaller.Instance;

            return(InvokeAsync <MeterUsageRequest, MeterUsageResponse>(request, marshaller,
                                                                       unmarshaller, cancellationToken));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initiates the asynchronous execution of the MeterUsage operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the MeterUsage operation on AmazonAWSMarketplaceMeteringClient.</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 EndMeterUsage
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/meteringmarketplace-2016-01-14/MeterUsage">REST API Reference for MeterUsage Operation</seealso>
        public virtual IAsyncResult BeginMeterUsage(MeterUsageRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new MeterUsageRequestMarshaller();
            var unmarshaller = MeterUsageResponseUnmarshaller.Instance;

            return(BeginInvoke <MeterUsageRequest>(request, marshaller, unmarshaller,
                                                   callback, state));
        }
        public void MeterUsageMarshallTest()
        {
            var request = InstantiateClassGenerator.Execute<MeterUsageRequest>();
            var marshaller = new MeterUsageRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);
            var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content);                        
            Comparer.CompareObjectToJson<MeterUsageRequest>(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("MeterUsage").ResponseStructure).Execute();
            webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString());
            UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse);
            var response = MeterUsageResponseUnmarshaller.Instance.Unmarshall(context)
                as MeterUsageResponse;
            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the MeterUsage operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the MeterUsage operation on AmazonAWSMarketplaceMeteringClient.</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 EndMeterUsage
        ///         operation.</returns>
        public IAsyncResult BeginMeterUsage(MeterUsageRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new MeterUsageRequestMarshaller();
            var unmarshaller = MeterUsageResponseUnmarshaller.Instance;

            return BeginInvoke<MeterUsageRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// API to emit metering records. For identical requests, the API is idempotent. It simply
        /// returns the metering record ID.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the MeterUsage service method.</param>
        /// 
        /// <returns>The response from the MeterUsage service method, as returned by AWSMarketplaceMetering.</returns>
        /// <exception cref="Amazon.AWSMarketplaceMetering.Model.DuplicateRequestException">
        /// A metering record has already been emitted by the same EC2 instance for the given
        /// {usageDimension, timestamp} with a different usageQuantity.
        /// </exception>
        /// <exception cref="Amazon.AWSMarketplaceMetering.Model.InternalServiceErrorException">
        /// An internal error has occurred. Retry your request. If the problem persists, post
        /// a message with details on the AWS forums.
        /// </exception>
        /// <exception cref="Amazon.AWSMarketplaceMetering.Model.InvalidEndpointRegionException">
        /// The endpoint being called is in a region different from your EC2 instance. The region
        /// of the Metering service endpoint and the region of the EC2 instance must match.
        /// </exception>
        /// <exception cref="Amazon.AWSMarketplaceMetering.Model.InvalidProductCodeException">
        /// The product code passed does not match the product code used for publishing the product.
        /// </exception>
        /// <exception cref="Amazon.AWSMarketplaceMetering.Model.InvalidUsageDimensionException">
        /// The usage dimension does not match one of the UsageDimensions associated with products.
        /// </exception>
        /// <exception cref="Amazon.AWSMarketplaceMetering.Model.ThrottlingException">
        /// The calls to the MeterUsage API are throttled.
        /// </exception>
        /// <exception cref="Amazon.AWSMarketplaceMetering.Model.TimestampOutOfBoundsException">
        /// The timestamp value passed in the meterUsage() is out of allowed range.
        /// </exception>
        public MeterUsageResponse MeterUsage(MeterUsageRequest request)
        {
            var marshaller = new MeterUsageRequestMarshaller();
            var unmarshaller = MeterUsageResponseUnmarshaller.Instance;

            return Invoke<MeterUsageRequest,MeterUsageResponse>(request, marshaller, unmarshaller);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the MeterUsage operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the MeterUsage 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<MeterUsageResponse> MeterUsageAsync(MeterUsageRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new MeterUsageRequestMarshaller();
            var unmarshaller = MeterUsageResponseUnmarshaller.Instance;

            return InvokeAsync<MeterUsageRequest,MeterUsageResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }