public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.AttachClassicLinkVpcRequest(); if (cmdletContext.Group != null) { request.Groups = cmdletContext.Group; } if (cmdletContext.InstanceId != null) { request.InstanceId = cmdletContext.InstanceId; } if (cmdletContext.VpcId != null) { request.VpcId = cmdletContext.VpcId; } 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 AttachClassicLinkVpc operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the AttachClassicLinkVpc 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<AttachClassicLinkVpcResponse> AttachClassicLinkVpcAsync(AttachClassicLinkVpcRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new AttachClassicLinkVpcRequestMarshaller(); var unmarshaller = AttachClassicLinkVpcResponseUnmarshaller.Instance; return InvokeAsync<AttachClassicLinkVpcRequest,AttachClassicLinkVpcResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Links an EC2-Classic instance to a ClassicLink-enabled VPC through one or more of /// the VPC's security groups. You cannot link an EC2-Classic instance to more than one /// VPC at a time. You can only link an instance that's in the <code>running</code> state. /// An instance is automatically unlinked from a VPC when it's stopped - you can link /// it to the VPC again when you restart it. /// /// /// <para> /// After you've linked an instance, you cannot change the VPC security groups that are /// associated with it. To change the security groups, you must first unlink the instance, /// and then link it again. /// </para> /// /// <para> /// Linking your instance to a VPC is sometimes referred to as <i>attaching</i> your instance. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the AttachClassicLinkVpc service method.</param> /// /// <returns>The response from the AttachClassicLinkVpc service method, as returned by EC2.</returns> public AttachClassicLinkVpcResponse AttachClassicLinkVpc(AttachClassicLinkVpcRequest request) { var marshaller = new AttachClassicLinkVpcRequestMarshaller(); var unmarshaller = AttachClassicLinkVpcResponseUnmarshaller.Instance; return Invoke<AttachClassicLinkVpcRequest,AttachClassicLinkVpcResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the AttachClassicLinkVpc operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the AttachClassicLinkVpc 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 EndAttachClassicLinkVpc /// operation.</returns> public IAsyncResult BeginAttachClassicLinkVpc(AttachClassicLinkVpcRequest request, AsyncCallback callback, object state) { var marshaller = new AttachClassicLinkVpcRequestMarshaller(); var unmarshaller = AttachClassicLinkVpcResponseUnmarshaller.Instance; return BeginInvoke<AttachClassicLinkVpcRequest>(request, marshaller, unmarshaller, callback, state); }
private Amazon.EC2.Model.AttachClassicLinkVpcResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.AttachClassicLinkVpcRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "AttachClassicLinkVpc"); try { #if DESKTOP return(client.AttachClassicLinkVpc(request)); #elif CORECLR return(client.AttachClassicLinkVpcAsync(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; } }