Пример #1
0
        public void PurchaseHostReservationMarshallTest()
        {
            var operation = service_model.FindOperation("PurchaseHostReservation");

            var request = InstantiateClassGenerator.Execute<PurchaseHostReservationRequest>();
            var marshaller = new PurchaseHostReservationRequestMarshaller();
            var internalRequest = marshaller.Marshall(request);
            var validator = new AWSQueryValidator(internalRequest.Parameters, request, service_model, operation);
            validator.Validate();


            var payloadResponse = new XmlSampleGenerator(service_model, operation).Execute();
            UnmarshallerContext context = new EC2UnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, new WebResponseData());
            var response = PurchaseHostReservationResponseUnmarshaller.Instance.Unmarshall(context)
                as PurchaseHostReservationResponse;   
            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);       
        }
Пример #2
0
        /// <summary>
        /// Purchase a reservation with configurations that match those of your Dedicated Host.
        /// You must have active Dedicated Hosts in your account before you purchase a reservation.
        /// This action results in the specified reservation being purchased and charged to your
        /// account.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the PurchaseHostReservation service method.</param>
        /// 
        /// <returns>The response from the PurchaseHostReservation service method, as returned by EC2.</returns>
        public PurchaseHostReservationResponse PurchaseHostReservation(PurchaseHostReservationRequest request)
        {
            var marshaller = new PurchaseHostReservationRequestMarshaller();
            var unmarshaller = PurchaseHostReservationResponseUnmarshaller.Instance;

            return Invoke<PurchaseHostReservationRequest,PurchaseHostReservationResponse>(request, marshaller, unmarshaller);
        }
Пример #3
0
        /// <summary>
        /// Initiates the asynchronous execution of the PurchaseHostReservation operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PurchaseHostReservation operation on AmazonEC2Client.</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 EndPurchaseHostReservation
        ///         operation.</returns>
        public IAsyncResult BeginPurchaseHostReservation(PurchaseHostReservationRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new PurchaseHostReservationRequestMarshaller();
            var unmarshaller = PurchaseHostReservationResponseUnmarshaller.Instance;

            return BeginInvoke<PurchaseHostReservationRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Пример #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the PurchaseHostReservation operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PurchaseHostReservation 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<PurchaseHostReservationResponse> PurchaseHostReservationAsync(PurchaseHostReservationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new PurchaseHostReservationRequestMarshaller();
            var unmarshaller = PurchaseHostReservationResponseUnmarshaller.Instance;

            return InvokeAsync<PurchaseHostReservationRequest,PurchaseHostReservationResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }