public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.CreatePlacementGroupRequest(); if (cmdletContext.GroupName != null) { request.GroupName = cmdletContext.GroupName; } if (cmdletContext.PartitionCount != null) { request.PartitionCount = cmdletContext.PartitionCount.Value; } if (cmdletContext.Strategy != null) { request.Strategy = cmdletContext.Strategy; } if (cmdletContext.TagSpecification != null) { request.TagSpecifications = cmdletContext.TagSpecification; } 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 CreatePlacementGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreatePlacementGroup 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<CreatePlacementGroupResponse> CreatePlacementGroupAsync(CreatePlacementGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreatePlacementGroupRequestMarshaller(); var unmarshaller = CreatePlacementGroupResponseUnmarshaller.Instance; return InvokeAsync<CreatePlacementGroupRequest,CreatePlacementGroupResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Creates a placement group that you launch cluster instances into. You must give the /// group a name that's unique within the scope of your account. /// /// /// <para> /// For more information about placement groups and cluster instances, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using_cluster_computing.html">Cluster /// Instances</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreatePlacementGroup service method.</param> /// /// <returns>The response from the CreatePlacementGroup service method, as returned by EC2.</returns> public CreatePlacementGroupResponse CreatePlacementGroup(CreatePlacementGroupRequest request) { var marshaller = new CreatePlacementGroupRequestMarshaller(); var unmarshaller = CreatePlacementGroupResponseUnmarshaller.Instance; return Invoke<CreatePlacementGroupRequest,CreatePlacementGroupResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreatePlacementGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreatePlacementGroup 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 EndCreatePlacementGroup /// operation.</returns> public IAsyncResult BeginCreatePlacementGroup(CreatePlacementGroupRequest request, AsyncCallback callback, object state) { var marshaller = new CreatePlacementGroupRequestMarshaller(); var unmarshaller = CreatePlacementGroupResponseUnmarshaller.Instance; return BeginInvoke<CreatePlacementGroupRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeCreatePlacementGroup(CreatePlacementGroupRequest createPlacementGroupRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new CreatePlacementGroupRequestMarshaller().Marshall(createPlacementGroupRequest); var unmarshaller = CreatePlacementGroupResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the CreatePlacementGroup operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.CreatePlacementGroup"/> /// </summary> /// /// <param name="createPlacementGroupRequest">Container for the necessary parameters to execute the CreatePlacementGroup 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> public IAsyncResult BeginCreatePlacementGroup(CreatePlacementGroupRequest createPlacementGroupRequest, AsyncCallback callback, object state) { return invokeCreatePlacementGroup(createPlacementGroupRequest, callback, state, false); }
/// <summary> /// <para>Creates a placement group that you launch cluster instances into. You must give the group a name that's unique within the scope of /// your account.</para> <para>For more information about placement groups and cluster instances, see <a /// href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using_cluster_computing.html" >Cluster Instances</a> in the <i>Amazon Elastic /// Compute Cloud User Guide</i> .</para> /// </summary> /// /// <param name="createPlacementGroupRequest">Container for the necessary parameters to execute the CreatePlacementGroup service method on /// AmazonEC2.</param> /// public CreatePlacementGroupResponse CreatePlacementGroup(CreatePlacementGroupRequest createPlacementGroupRequest) { IAsyncResult asyncResult = invokeCreatePlacementGroup(createPlacementGroupRequest, null, null, true); return EndCreatePlacementGroup(asyncResult); }
/// <summary> /// <para>Creates a placement group that you launch cluster instances into. You must give the group a name that's unique within the scope of /// your account.</para> <para>For more information about placement groups and cluster instances, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using_cluster_computing.html">Cluster Instances</a> in the <i>Amazon Elastic /// Compute Cloud User Guide</i> .</para> /// </summary> /// /// <param name="createPlacementGroupRequest">Container for the necessary parameters to execute the CreatePlacementGroup service method on /// AmazonEC2.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<CreatePlacementGroupResponse> CreatePlacementGroupAsync(CreatePlacementGroupRequest createPlacementGroupRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreatePlacementGroupRequestMarshaller(); var unmarshaller = CreatePlacementGroupResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreatePlacementGroupRequest, CreatePlacementGroupResponse>(createPlacementGroupRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal CreatePlacementGroupResponse CreatePlacementGroup(CreatePlacementGroupRequest request) { var task = CreatePlacementGroupAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the CreatePlacementGroup operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.CreatePlacementGroup"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreatePlacementGroup 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<CreatePlacementGroupResponse> CreatePlacementGroupAsync(CreatePlacementGroupRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreatePlacementGroupRequestMarshaller(); var unmarshaller = CreatePlacementGroupResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, CreatePlacementGroupRequest, CreatePlacementGroupResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para> Creates a PlacementGroup into which multiple Amazon EC2 instances can be launched. Users must give the group a name unique within the /// scope of the user account. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreatePlacementGroup service method on /// AmazonEC2.</param> public CreatePlacementGroupResponse CreatePlacementGroup(CreatePlacementGroupRequest request) { var task = CreatePlacementGroupAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
private Amazon.EC2.Model.CreatePlacementGroupResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.CreatePlacementGroupRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "CreatePlacementGroup"); try { #if DESKTOP return(client.CreatePlacementGroup(request)); #elif CORECLR return(client.CreatePlacementGroupAsync(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; } }