public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.IoT.Model.TransferCertificateRequest(); if (cmdletContext.CertificateId != null) { request.CertificateId = cmdletContext.CertificateId; } if (cmdletContext.TargetAwsAccount != null) { request.TargetAwsAccount = cmdletContext.TargetAwsAccount; } if (cmdletContext.TransferMessage != null) { request.TransferMessage = cmdletContext.TransferMessage; } 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); }
private Amazon.IoT.Model.TransferCertificateResponse CallAWSServiceOperation(IAmazonIoT client, Amazon.IoT.Model.TransferCertificateRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT", "TransferCertificate"); try { #if DESKTOP return(client.TransferCertificate(request)); #elif CORECLR return(client.TransferCertificateAsync(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 TransferCertificate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the TransferCertificate 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<TransferCertificateResponse> TransferCertificateAsync(TransferCertificateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new TransferCertificateRequestMarshaller(); var unmarshaller = TransferCertificateResponseUnmarshaller.Instance; return InvokeAsync<TransferCertificateRequest,TransferCertificateResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Transfers the specified certificate to the specified AWS account. /// /// /// <para> /// You can cancel the transfer until it is acknowledged by the recipient. /// </para> /// /// <para> /// No notification is sent to the transfer destination's account, it is up to the caller /// to notify the transfer target. /// </para> /// /// <para> /// The certificate being transferred must not be in the ACTIVE state. It can be deactivated /// using the UpdateCertificate API. /// </para> /// /// <para> /// The certificate must not have any policies attached to it. These can be detached using /// the DetachPrincipalPolicy API. /// </para> /// </summary> /// <param name="certificateId">The ID of the certificate.</param> /// <param name="targetAwsAccount">The AWS account.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the TransferCertificate service method, as returned by IoT.</returns> /// <exception cref="Amazon.IoT.Model.CertificateStateException"> /// The certificate operation is not allowed. /// </exception> /// <exception cref="Amazon.IoT.Model.InternalFailureException"> /// An unexpected error has occurred. /// </exception> /// <exception cref="Amazon.IoT.Model.InvalidRequestException"> /// The request is not valid. /// </exception> /// <exception cref="Amazon.IoT.Model.ResourceNotFoundException"> /// The specified resource does not exist. /// </exception> /// <exception cref="Amazon.IoT.Model.ServiceUnavailableException"> /// The service is temporarily unavailable. /// </exception> /// <exception cref="Amazon.IoT.Model.ThrottlingException"> /// The rate exceeds the limit. /// </exception> /// <exception cref="Amazon.IoT.Model.TransferConflictException"> /// You can't transfer the the certificate because authorization policies are still attached. /// </exception> /// <exception cref="Amazon.IoT.Model.UnauthorizedException"> /// You are not authorized to perform this operation. /// </exception> public Task<TransferCertificateResponse> TransferCertificateAsync(string certificateId, string targetAwsAccount, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new TransferCertificateRequest(); request.CertificateId = certificateId; request.TargetAwsAccount = targetAwsAccount; return TransferCertificateAsync(request, cancellationToken); }
/// <summary> /// Transfers the specified certificate to the specified AWS account. /// /// /// <para> /// You can cancel the transfer until it is acknowledged by the recipient. /// </para> /// /// <para> /// No notification is sent to the transfer destination's account, it is up to the caller /// to notify the transfer target. /// </para> /// /// <para> /// The certificate being transferred must not be in the ACTIVE state. It can be deactivated /// using the UpdateCertificate API. /// </para> /// /// <para> /// The certificate must not have any policies attached to it. These can be detached using /// the DetachPrincipalPolicy API. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the TransferCertificate service method.</param> /// /// <returns>The response from the TransferCertificate service method, as returned by IoT.</returns> /// <exception cref="Amazon.IoT.Model.CertificateStateException"> /// The certificate operation is not allowed. /// </exception> /// <exception cref="Amazon.IoT.Model.InternalFailureException"> /// An unexpected error has occurred. /// </exception> /// <exception cref="Amazon.IoT.Model.InvalidRequestException"> /// The request is not valid. /// </exception> /// <exception cref="Amazon.IoT.Model.ResourceNotFoundException"> /// The specified resource does not exist. /// </exception> /// <exception cref="Amazon.IoT.Model.ServiceUnavailableException"> /// The service is temporarily unavailable. /// </exception> /// <exception cref="Amazon.IoT.Model.ThrottlingException"> /// The rate exceeds the limit. /// </exception> /// <exception cref="Amazon.IoT.Model.TransferConflictException"> /// You can't transfer the the certificate because authorization policies are still attached. /// </exception> /// <exception cref="Amazon.IoT.Model.UnauthorizedException"> /// You are not authorized to perform this operation. /// </exception> public TransferCertificateResponse TransferCertificate(TransferCertificateRequest request) { var marshaller = new TransferCertificateRequestMarshaller(); var unmarshaller = TransferCertificateResponseUnmarshaller.Instance; return Invoke<TransferCertificateRequest,TransferCertificateResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Transfers the specified certificate to the specified AWS account. /// /// /// <para> /// You can cancel the transfer until it is acknowledged by the recipient. /// </para> /// /// <para> /// No notification is sent to the transfer destination's account, it is up to the caller /// to notify the transfer target. /// </para> /// /// <para> /// The certificate being transferred must not be in the ACTIVE state. It can be deactivated /// using the UpdateCertificate API. /// </para> /// /// <para> /// The certificate must not have any policies attached to it. These can be detached using /// the DetachPrincipalPolicy API. /// </para> /// </summary> /// <param name="certificateId">The ID of the certificate.</param> /// <param name="targetAwsAccount">The AWS account.</param> /// /// <returns>The response from the TransferCertificate service method, as returned by IoT.</returns> /// <exception cref="Amazon.IoT.Model.CertificateStateException"> /// The certificate operation is not allowed. /// </exception> /// <exception cref="Amazon.IoT.Model.InternalFailureException"> /// An unexpected error has occurred. /// </exception> /// <exception cref="Amazon.IoT.Model.InvalidRequestException"> /// The request is not valid. /// </exception> /// <exception cref="Amazon.IoT.Model.ResourceNotFoundException"> /// The specified resource does not exist. /// </exception> /// <exception cref="Amazon.IoT.Model.ServiceUnavailableException"> /// The service is temporarily unavailable. /// </exception> /// <exception cref="Amazon.IoT.Model.ThrottlingException"> /// The rate exceeds the limit. /// </exception> /// <exception cref="Amazon.IoT.Model.TransferConflictException"> /// You can't transfer the the certificate because authorization policies are still attached. /// </exception> /// <exception cref="Amazon.IoT.Model.UnauthorizedException"> /// You are not authorized to perform this operation. /// </exception> public TransferCertificateResponse TransferCertificate(string certificateId, string targetAwsAccount) { var request = new TransferCertificateRequest(); request.CertificateId = certificateId; request.TargetAwsAccount = targetAwsAccount; return TransferCertificate(request); }
/// <summary> /// Initiates the asynchronous execution of the TransferCertificate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the TransferCertificate operation on AmazonIoTClient.</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 EndTransferCertificate /// operation.</returns> public IAsyncResult BeginTransferCertificate(TransferCertificateRequest request, AsyncCallback callback, object state) { var marshaller = new TransferCertificateRequestMarshaller(); var unmarshaller = TransferCertificateResponseUnmarshaller.Instance; return BeginInvoke<TransferCertificateRequest>(request, marshaller, unmarshaller, callback, state); }