/// <summary> /// Initiates the asynchronous execution of the RegisterInstance operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RegisterInstance 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<RegisterInstanceResponse> RegisterInstanceAsync(RegisterInstanceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RegisterInstanceRequestMarshaller(); var unmarshaller = RegisterInstanceResponseUnmarshaller.Instance; return InvokeAsync<RegisterInstanceRequest,RegisterInstanceResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal RegisterInstanceResponse RegisterInstance(RegisterInstanceRequest request) { var marshaller = new RegisterInstanceRequestMarshaller(); var unmarshaller = RegisterInstanceResponseUnmarshaller.Instance; return Invoke<RegisterInstanceRequest,RegisterInstanceResponse>(request, marshaller, unmarshaller); }
private Amazon.OpsWorks.Model.RegisterInstanceResponse CallAWSServiceOperation(IAmazonOpsWorks client, Amazon.OpsWorks.Model.RegisterInstanceRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS OpsWorks", "RegisterInstance"); try { #if DESKTOP return(client.RegisterInstance(request)); #elif CORECLR return(client.RegisterInstanceAsync(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 RegisterInstance operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RegisterInstance operation on AmazonOpsWorksClient.</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 EndRegisterInstance /// operation.</returns> public IAsyncResult BeginRegisterInstance(RegisterInstanceRequest request, AsyncCallback callback, object state) { var marshaller = new RegisterInstanceRequestMarshaller(); var unmarshaller = RegisterInstanceResponseUnmarshaller.Instance; return BeginInvoke<RegisterInstanceRequest>(request, marshaller, unmarshaller, callback, state); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.OpsWorks.Model.RegisterInstanceRequest(); if (cmdletContext.Hostname != null) { request.Hostname = cmdletContext.Hostname; } // populate InstanceIdentity var requestInstanceIdentityIsNull = true; request.InstanceIdentity = new Amazon.OpsWorks.Model.InstanceIdentity(); System.String requestInstanceIdentity_instanceIdentity_Document = null; if (cmdletContext.InstanceIdentity_Document != null) { requestInstanceIdentity_instanceIdentity_Document = cmdletContext.InstanceIdentity_Document; } if (requestInstanceIdentity_instanceIdentity_Document != null) { request.InstanceIdentity.Document = requestInstanceIdentity_instanceIdentity_Document; requestInstanceIdentityIsNull = false; } System.String requestInstanceIdentity_instanceIdentity_Signature = null; if (cmdletContext.InstanceIdentity_Signature != null) { requestInstanceIdentity_instanceIdentity_Signature = cmdletContext.InstanceIdentity_Signature; } if (requestInstanceIdentity_instanceIdentity_Signature != null) { request.InstanceIdentity.Signature = requestInstanceIdentity_instanceIdentity_Signature; requestInstanceIdentityIsNull = false; } // determine if request.InstanceIdentity should be set to null if (requestInstanceIdentityIsNull) { request.InstanceIdentity = null; } if (cmdletContext.PrivateIp != null) { request.PrivateIp = cmdletContext.PrivateIp; } if (cmdletContext.PublicIp != null) { request.PublicIp = cmdletContext.PublicIp; } if (cmdletContext.RsaPublicKey != null) { request.RsaPublicKey = cmdletContext.RsaPublicKey; } if (cmdletContext.RsaPublicKeyFingerprint != null) { request.RsaPublicKeyFingerprint = cmdletContext.RsaPublicKeyFingerprint; } if (cmdletContext.StackId != null) { request.StackId = cmdletContext.StackId; } 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); }