protected override void ProcessRecord() { AmazonEC2 client = base.GetClient(); Amazon.EC2.Model.AssociateDhcpOptionsRequest request = new Amazon.EC2.Model.AssociateDhcpOptionsRequest(); request.DhcpOptionsId = this._DhcpOptionsId; request.VpcId = this._VpcId; Amazon.EC2.Model.AssociateDhcpOptionsResponse response = client.AssociateDhcpOptions(request); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.AssociateDhcpOptionsRequest(); if (cmdletContext.DhcpOptionsId != null) { request.DhcpOptionsId = cmdletContext.DhcpOptionsId; } 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 AssociateDhcpOptions operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the AssociateDhcpOptions 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<AssociateDhcpOptionsResponse> AssociateDhcpOptionsAsync(AssociateDhcpOptionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new AssociateDhcpOptionsRequestMarshaller(); var unmarshaller = AssociateDhcpOptionsResponseUnmarshaller.Instance; return InvokeAsync<AssociateDhcpOptionsRequest,AssociateDhcpOptionsResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Associates a set of DHCP options (that you've previously created) with the specified /// VPC, or associates no DHCP options with the VPC. /// /// /// <para> /// After you associate the options with the VPC, any existing instances and all new instances /// that you launch in that VPC use the options. You don't need to restart or relaunch /// the instances. They automatically pick up the changes within a few hours, depending /// on how frequently the instance renews its DHCP lease. You can explicitly renew the /// lease using the operating system on the instance. /// </para> /// /// <para> /// For more information, 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 AssociateDhcpOptions service method.</param> /// /// <returns>The response from the AssociateDhcpOptions service method, as returned by EC2.</returns> public AssociateDhcpOptionsResponse AssociateDhcpOptions(AssociateDhcpOptionsRequest request) { var marshaller = new AssociateDhcpOptionsRequestMarshaller(); var unmarshaller = AssociateDhcpOptionsResponseUnmarshaller.Instance; return Invoke<AssociateDhcpOptionsRequest,AssociateDhcpOptionsResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the AssociateDhcpOptions operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the AssociateDhcpOptions 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 EndAssociateDhcpOptions /// operation.</returns> public IAsyncResult BeginAssociateDhcpOptions(AssociateDhcpOptionsRequest request, AsyncCallback callback, object state) { var marshaller = new AssociateDhcpOptionsRequestMarshaller(); var unmarshaller = AssociateDhcpOptionsResponseUnmarshaller.Instance; return BeginInvoke<AssociateDhcpOptionsRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeAssociateDhcpOptions(AssociateDhcpOptionsRequest associateDhcpOptionsRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new AssociateDhcpOptionsRequestMarshaller().Marshall(associateDhcpOptionsRequest); var unmarshaller = AssociateDhcpOptionsResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the AssociateDhcpOptions operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.AssociateDhcpOptions"/> /// </summary> /// /// <param name="associateDhcpOptionsRequest">Container for the necessary parameters to execute the AssociateDhcpOptions 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 BeginAssociateDhcpOptions(AssociateDhcpOptionsRequest associateDhcpOptionsRequest, AsyncCallback callback, object state) { return invokeAssociateDhcpOptions(associateDhcpOptionsRequest, callback, state, false); }
/// <summary> /// <para>Associates a set of DHCP options (that you've previously created) with the specified VPC, or associates no DHCP options with the /// VPC.</para> <para>After you associate the options with the VPC, any existing instances and all new instances that you launch in that VPC use /// the options. You don't need to restart or relaunch the instances. They automatically pick up the changes within a few hours, depending on /// how frequently the instance renews its DHCP lease. You can explicitly renew the lease using the operating system on the instance.</para> /// <para>For more information, 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="associateDhcpOptionsRequest">Container for the necessary parameters to execute the AssociateDhcpOptions service method on /// AmazonEC2.</param> /// public AssociateDhcpOptionsResponse AssociateDhcpOptions(AssociateDhcpOptionsRequest associateDhcpOptionsRequest) { IAsyncResult asyncResult = invokeAssociateDhcpOptions(associateDhcpOptionsRequest, null, null, true); return EndAssociateDhcpOptions(asyncResult); }
/// <summary> /// <para>Associates a set of DHCP options (that you've previously created) with the specified VPC, or associates no DHCP options with the /// VPC.</para> <para>After you associate the options with the VPC, any existing instances and all new instances that you launch in that VPC use /// the options. You don't need to restart or relaunch the instances. They automatically pick up the changes within a few hours, depending on /// how frequently the instance renews its DHCP lease. You can explicitly renew the lease using the operating system on the instance.</para> /// <para>For more information, 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="associateDhcpOptionsRequest">Container for the necessary parameters to execute the AssociateDhcpOptions 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<AssociateDhcpOptionsResponse> AssociateDhcpOptionsAsync(AssociateDhcpOptionsRequest associateDhcpOptionsRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new AssociateDhcpOptionsRequestMarshaller(); var unmarshaller = AssociateDhcpOptionsResponseUnmarshaller.GetInstance(); return Invoke<IRequest, AssociateDhcpOptionsRequest, AssociateDhcpOptionsResponse>(associateDhcpOptionsRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal AssociateDhcpOptionsResponse AssociateDhcpOptions(AssociateDhcpOptionsRequest request) { var task = AssociateDhcpOptionsAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the AssociateDhcpOptions operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.AssociateDhcpOptions"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the AssociateDhcpOptions 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<AssociateDhcpOptionsResponse> AssociateDhcpOptionsAsync(AssociateDhcpOptionsRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new AssociateDhcpOptionsRequestMarshaller(); var unmarshaller = AssociateDhcpOptionsResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, AssociateDhcpOptionsRequest, AssociateDhcpOptionsResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para> Associates a set of DHCP options (that you've previously created) with the specified VPC. Or, associates the default DHCP options /// with the VPC. The default set consists of the standard EC2 host name, no domain name, no DNS server, no NTP server, and no NetBIOS server or /// node type. After you associate the options with the VPC, any existing instances and all new instances that you launch in that VPC use the /// options. For more information about the supported DHCP options and using them with Amazon VPC, go to Using DHCP Options in the Amazon /// Virtual Private Cloud Developer Guide. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the AssociateDhcpOptions service method on /// AmazonEC2.</param> public AssociateDhcpOptionsResponse AssociateDhcpOptions(AssociateDhcpOptionsRequest request) { var task = AssociateDhcpOptionsAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
private Amazon.EC2.Model.AssociateDhcpOptionsResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.AssociateDhcpOptionsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "AssociateDhcpOptions"); try { #if DESKTOP return(client.AssociateDhcpOptions(request)); #elif CORECLR return(client.AssociateDhcpOptionsAsync(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; } }