public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.CreateVpcRequest(); if (cmdletContext.AmazonProvidedIpv6CidrBlock != null) { request.AmazonProvidedIpv6CidrBlock = cmdletContext.AmazonProvidedIpv6CidrBlock.Value; } if (cmdletContext.CidrBlock != null) { request.CidrBlock = cmdletContext.CidrBlock; } if (cmdletContext.InstanceTenancy != null) { request.InstanceTenancy = cmdletContext.InstanceTenancy; } if (cmdletContext.Ipv6CidrBlock != null) { request.Ipv6CidrBlock = cmdletContext.Ipv6CidrBlock; } if (cmdletContext.Ipv6CidrBlockNetworkBorderGroup != null) { request.Ipv6CidrBlockNetworkBorderGroup = cmdletContext.Ipv6CidrBlockNetworkBorderGroup; } if (cmdletContext.Ipv6Pool != null) { request.Ipv6Pool = cmdletContext.Ipv6Pool; } 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); }
protected override void ProcessRecord() { AmazonEC2 client = base.GetClient(); Amazon.EC2.Model.CreateVpcRequest request = new Amazon.EC2.Model.CreateVpcRequest(); request.CidrBlock = this._CidrBlock; Amazon.EC2.Model.CreateVpcResponse response = client.CreateVpc(request); base.WriteObject(response.CreateVpcResult.Vpc, true); }
public async Task CreateVpc() { _context.Logger.WriteLine("CreateVpc"); var request = new CreateVpcRequest { CidrBlock = _cluster.VpcCidr, InstanceTenancy = Tenancy.Default }; var response = await _client.CreateVpcAsync(request); _context.Logger.WriteLine($"Vpc Created: {response.Vpc.CidrBlock} Id: {response.Vpc.VpcId}"); }
/// <summary> /// Initiates the asynchronous execution of the CreateVpc operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateVpc 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<CreateVpcResponse> CreateVpcAsync(CreateVpcRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateVpcRequestMarshaller(); var unmarshaller = CreateVpcResponseUnmarshaller.Instance; return InvokeAsync<CreateVpcRequest,CreateVpcResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Creates a VPC with the specified CIDR block. /// /// /// <para> /// The smallest VPC you can create uses a /28 netmask (16 IP addresses), and the largest /// uses a /16 netmask (65,536 IP addresses). To help you decide how big to make your /// VPC, see <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html">Your /// VPC and Subnets</a> in the <i>Amazon Virtual Private Cloud User Guide</i>. /// </para> /// /// <para> /// By default, each instance you launch in the VPC has the default DHCP options, which /// includes only a default DNS server that we provide (AmazonProvidedDNS). For more information /// about DHCP options, see <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html">DHCP /// Options Sets</a> in the <i>Amazon Virtual Private Cloud User Guide</i>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateVpc service method.</param> /// /// <returns>The response from the CreateVpc service method, as returned by EC2.</returns> public CreateVpcResponse CreateVpc(CreateVpcRequest request) { var marshaller = new CreateVpcRequestMarshaller(); var unmarshaller = CreateVpcResponseUnmarshaller.Instance; return Invoke<CreateVpcRequest,CreateVpcResponse>(request, marshaller, unmarshaller); }
private Amazon.EC2.Model.CreateVpcResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.CreateVpcRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "CreateVpc"); try { #if DESKTOP return(client.CreateVpc(request)); #elif CORECLR return(client.CreateVpcAsync(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 CreateVpc operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateVpc 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 EndCreateVpc /// operation.</returns> public IAsyncResult BeginCreateVpc(CreateVpcRequest request, AsyncCallback callback, object state) { var marshaller = new CreateVpcRequestMarshaller(); var unmarshaller = CreateVpcResponseUnmarshaller.Instance; return BeginInvoke<CreateVpcRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeCreateVpc(CreateVpcRequest createVpcRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new CreateVpcRequestMarshaller().Marshall(createVpcRequest); var unmarshaller = CreateVpcResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the CreateVpc operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.CreateVpc"/> /// </summary> /// /// <param name="createVpcRequest">Container for the necessary parameters to execute the CreateVpc 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 EndCreateVpc /// operation.</returns> public IAsyncResult BeginCreateVpc(CreateVpcRequest createVpcRequest, AsyncCallback callback, object state) { return invokeCreateVpc(createVpcRequest, callback, state, false); }
/// <summary> /// <para>Creates a VPC with the specified CIDR block.</para> <para>The smallest VPC you can create uses a /28 netmask (16 IP addresses), and /// the largest uses a /16 netmask (65,536 IP addresses). To help you decide how big to make your VPC, see <a /// href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html" >Your VPC and Subnets</a> in the <i>Amazon Virtual Private /// Cloud User Guide</i> .</para> <para>By default, each instance you launch in the VPC has the default DHCP options, which includes only a /// default DNS server that we provide (AmazonProvidedDNS). For more information about DHCP options, see <a /// href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html" >DHCP Options Sets</a> in the <i>Amazon Virtual Private /// Cloud User Guide</i> .</para> /// </summary> /// /// <param name="createVpcRequest">Container for the necessary parameters to execute the CreateVpc service method on AmazonEC2.</param> /// /// <returns>The response from the CreateVpc service method, as returned by AmazonEC2.</returns> /// public CreateVpcResponse CreateVpc(CreateVpcRequest createVpcRequest) { IAsyncResult asyncResult = invokeCreateVpc(createVpcRequest, null, null, true); return EndCreateVpc(asyncResult); }
/// <summary> /// <para>Creates a VPC with the specified CIDR block.</para> <para>The smallest VPC you can create uses a /28 netmask (16 IP addresses), and /// the largest uses a /16 netmask (65,536 IP addresses). To help you decide how big to make your VPC, see <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html">Your VPC and Subnets</a> in the <i>Amazon Virtual Private /// Cloud User Guide</i> .</para> <para>By default, each instance you launch in the VPC has the default DHCP options, which includes only a /// default DNS server that we provide (AmazonProvidedDNS). For more information about DHCP options, see <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html">DHCP Options Sets</a> in the <i>Amazon Virtual Private /// Cloud User Guide</i> .</para> /// </summary> /// /// <param name="createVpcRequest">Container for the necessary parameters to execute the CreateVpc service method on AmazonEC2.</param> /// /// <returns>The response from the CreateVpc 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<CreateVpcResponse> CreateVpcAsync(CreateVpcRequest createVpcRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateVpcRequestMarshaller(); var unmarshaller = CreateVpcResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreateVpcRequest, CreateVpcResponse>(createVpcRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal CreateVpcResponse CreateVpc(CreateVpcRequest request) { var task = CreateVpcAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the CreateVpc operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.CreateVpc"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateVpc 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<CreateVpcResponse> CreateVpcAsync(CreateVpcRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateVpcRequestMarshaller(); var unmarshaller = CreateVpcResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, CreateVpcRequest, CreateVpcResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para> Creates a VPC with the CIDR block you specify. The smallest VPC you can create uses a <c>/28</c> netmask (16 IP addresses), and the /// largest uses a <c>/18</c> netmask (16,384 IP addresses). To help you decide how big to make your VPC, go to the topic about creating VPCs in /// the Amazon Virtual Private Cloud Developer Guide. </para> <para> By default, each instance you launch in the VPC has the default DHCP /// options (the standard EC2 host name, no domain name, no DNS server, no NTP server, and no NetBIOS server or node type). </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateVpc service method on AmazonEC2.</param> /// /// <returns>The response from the CreateVpc service method, as returned by AmazonEC2.</returns> public CreateVpcResponse CreateVpc(CreateVpcRequest request) { var task = CreateVpcAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }