public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.CreateReservedInstancesListingRequest(); if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } if (cmdletContext.InstanceCount != null) { request.InstanceCount = cmdletContext.InstanceCount.Value; } if (cmdletContext.PriceSchedule != null) { request.PriceSchedules = cmdletContext.PriceSchedule; } if (cmdletContext.ReservedInstancesId != null) { request.ReservedInstancesId = cmdletContext.ReservedInstancesId; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
/// <summary> /// Initiates the asynchronous execution of the CreateReservedInstancesListing operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateReservedInstancesListing 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<CreateReservedInstancesListingResponse> CreateReservedInstancesListingAsync(CreateReservedInstancesListingRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateReservedInstancesListingRequestMarshaller(); var unmarshaller = CreateReservedInstancesListingResponseUnmarshaller.Instance; return InvokeAsync<CreateReservedInstancesListingRequest,CreateReservedInstancesListingResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Creates a listing for Amazon EC2 Reserved Instances to be sold in the Reserved Instance /// Marketplace. You can submit one Reserved Instance listing at a time. To get a list /// of your Reserved Instances, you can use the <a>DescribeReservedInstances</a> operation. /// /// /// <para> /// The Reserved Instance Marketplace matches sellers who want to resell Reserved Instance /// capacity that they no longer need with buyers who want to purchase additional capacity. /// Reserved Instances bought and sold through the Reserved Instance Marketplace work /// like any other Reserved Instances. /// </para> /// /// <para> /// To sell your Reserved Instances, you must first register as a seller in the Reserved /// Instance Marketplace. After completing the registration process, you can create a /// Reserved Instance Marketplace listing of some or all of your Reserved Instances, and /// specify the upfront price to receive for them. Your Reserved Instance listings then /// become available for purchase. To view the details of your Reserved Instance listing, /// you can use the <a>DescribeReservedInstancesListings</a> operation. /// </para> /// /// <para> /// For more information, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html">Reserved /// Instance Marketplace</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateReservedInstancesListing service method.</param> /// /// <returns>The response from the CreateReservedInstancesListing service method, as returned by EC2.</returns> public CreateReservedInstancesListingResponse CreateReservedInstancesListing(CreateReservedInstancesListingRequest request) { var marshaller = new CreateReservedInstancesListingRequestMarshaller(); var unmarshaller = CreateReservedInstancesListingResponseUnmarshaller.Instance; return Invoke<CreateReservedInstancesListingRequest,CreateReservedInstancesListingResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateReservedInstancesListing operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateReservedInstancesListing 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 EndCreateReservedInstancesListing /// operation.</returns> public IAsyncResult BeginCreateReservedInstancesListing(CreateReservedInstancesListingRequest request, AsyncCallback callback, object state) { var marshaller = new CreateReservedInstancesListingRequestMarshaller(); var unmarshaller = CreateReservedInstancesListingResponseUnmarshaller.Instance; return BeginInvoke<CreateReservedInstancesListingRequest>(request, marshaller, unmarshaller, callback, state); }
private Amazon.EC2.Model.CreateReservedInstancesListingResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.CreateReservedInstancesListingRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "CreateReservedInstancesListing"); try { #if DESKTOP return(client.CreateReservedInstancesListing(request)); #elif CORECLR return(client.CreateReservedInstancesListingAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
/// <summary> /// Initiates the asynchronous execution of the CreateReservedInstancesListing operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.CreateReservedInstancesListing"/> /// </summary> /// /// <param name="createReservedInstancesListingRequest">Container for the necessary parameters to execute the CreateReservedInstancesListing /// operation on AmazonEC2.</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 /// EndCreateReservedInstancesListing operation.</returns> public IAsyncResult BeginCreateReservedInstancesListing(CreateReservedInstancesListingRequest createReservedInstancesListingRequest, AsyncCallback callback, object state) { return invokeCreateReservedInstancesListing(createReservedInstancesListingRequest, callback, state, false); }
IAsyncResult invokeCreateReservedInstancesListing(CreateReservedInstancesListingRequest createReservedInstancesListingRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new CreateReservedInstancesListingRequestMarshaller().Marshall(createReservedInstancesListingRequest); var unmarshaller = CreateReservedInstancesListingResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para>Creates a listing for Amazon EC2 Reserved Instances to be sold in the Reserved Instance Marketplace. You can submit one Reserved /// Instance listing at a time.</para> <para>For more information, see <a /// href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html" >Reserved Instance Marketplace</a> in the <i>Amazon Elastic /// Compute Cloud User Guide</i> .</para> /// </summary> /// /// <param name="createReservedInstancesListingRequest">Container for the necessary parameters to execute the CreateReservedInstancesListing /// service method on AmazonEC2.</param> /// /// <returns>The response from the CreateReservedInstancesListing service method, as returned by AmazonEC2.</returns> /// public CreateReservedInstancesListingResponse CreateReservedInstancesListing(CreateReservedInstancesListingRequest createReservedInstancesListingRequest) { IAsyncResult asyncResult = invokeCreateReservedInstancesListing(createReservedInstancesListingRequest, null, null, true); return EndCreateReservedInstancesListing(asyncResult); }
/// <summary> /// <para>Creates a listing for Amazon EC2 Reserved Instances to be sold in the Reserved Instance Marketplace. You can submit one Reserved /// Instance listing at a time.</para> <para>For more information, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html">Reserved Instance Marketplace</a> in the <i>Amazon Elastic /// Compute Cloud User Guide</i> .</para> /// </summary> /// /// <param name="createReservedInstancesListingRequest">Container for the necessary parameters to execute the CreateReservedInstancesListing /// service method on AmazonEC2.</param> /// /// <returns>The response from the CreateReservedInstancesListing service method, as returned by AmazonEC2.</returns> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<CreateReservedInstancesListingResponse> CreateReservedInstancesListingAsync(CreateReservedInstancesListingRequest createReservedInstancesListingRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateReservedInstancesListingRequestMarshaller(); var unmarshaller = CreateReservedInstancesListingResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreateReservedInstancesListingRequest, CreateReservedInstancesListingResponse>(createReservedInstancesListingRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal CreateReservedInstancesListingResponse CreateReservedInstancesListing(CreateReservedInstancesListingRequest request) { var task = CreateReservedInstancesListingAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the CreateReservedInstancesListing operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.CreateReservedInstancesListing"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateReservedInstancesListing 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 async Task<CreateReservedInstancesListingResponse> CreateReservedInstancesListingAsync(CreateReservedInstancesListingRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateReservedInstancesListingRequestMarshaller(); var unmarshaller = CreateReservedInstancesListingResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, CreateReservedInstancesListingRequest, CreateReservedInstancesListingResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateReservedInstancesListing /// service method on AmazonEC2.</param> /// /// <returns>The response from the CreateReservedInstancesListing service method, as returned by AmazonEC2.</returns> public CreateReservedInstancesListingResponse CreateReservedInstancesListing(CreateReservedInstancesListingRequest request) { var task = CreateReservedInstancesListingAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }