public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.IoT.Model.CreateCertificateFromCsrRequest(); if (cmdletContext.CertificateSigningRequest != null) { request.CertificateSigningRequest = cmdletContext.CertificateSigningRequest; } if (cmdletContext.SetAsActive != null) { request.SetAsActive = cmdletContext.SetAsActive.Value; } 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.CreateCertificateFromCsrResponse CallAWSServiceOperation(IAmazonIoT client, Amazon.IoT.Model.CreateCertificateFromCsrRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT", "CreateCertificateFromCsr"); try { #if DESKTOP return(client.CreateCertificateFromCsr(request)); #elif CORECLR return(client.CreateCertificateFromCsrAsync(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> /// Creates an X.509 certificate using the specified certificate signing request. /// /// /// <para> /// <b>Note</b> Reusing the same certificate signing request (CSR) results in a distinct /// certificate. /// </para> /// /// <para> /// You can create multiple certificates in a batch by creating a directory and copying /// multiple .csr files into that directory and specifying that directory on the command /// line. The following commands show how to create a batch of certificates given a batch /// of CSRs. /// </para> /// /// <para> /// Assuming a set of CSRs are located inside of the directory my-csr-directory: /// </para> /// > /// <para> /// On Linux and OSX, the command is: /// </para> /// /// <para> /// $ ls my-csr-directory/ | xargs -I {} aws iot create-certificate-from-csr --certificate-signing-request /// file://my-csr-directory/{} /// </para> /// /// <para> /// This command lists all of the CSRs in my-csr-directory and pipes each CSR filename /// to the aws iot create-certificate-from-csr AWS CLI command to create a certificate /// for the corresponding CSR. /// </para> /// /// <para> /// The aws iot create-certificate-from-csr part of the command can also be run in parallel /// to speed up the certificate creation process: /// </para> /// /// <para> /// $ ls my-csr-directory/ | xargs -P 10 -I {} aws iot create-certificate-from-csr --certificate-signing-request /// file://my-csr-directory/{} /// </para> /// /// <para> /// On Windows PowerShell, the command to create certificates for all CSRs in my-csr-directory /// is: /// </para> /// /// <para> /// > ls -Name my-csr-directory | %{aws iot create-certificate-from-csr --certificate-signing-request /// file://my-csr-directory/$_} /// </para> /// /// <para> /// On Windows Command Prompt, the command to create certificates for all CSRs in my-csr-directory /// is: /// </para> /// /// <para> /// > forfiles /p my-csr-directory /c "cmd /c aws iot create-certificate-from-csr /// --certificate-signing-request file://@path" /// </para> /// </summary> /// <param name="certificateSigningRequest">The certificate signing request (CSR).</param> /// <param name="setAsActive">Specifies whether the certificate is active.</param> /// /// <returns>The response from the CreateCertificateFromCsr service method, as returned by IoT.</returns> /// <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.ServiceUnavailableException"> /// The service is temporarily unavailable. /// </exception> /// <exception cref="Amazon.IoT.Model.ThrottlingException"> /// The rate exceeds the limit. /// </exception> /// <exception cref="Amazon.IoT.Model.UnauthorizedException"> /// You are not authorized to perform this operation. /// </exception> public CreateCertificateFromCsrResponse CreateCertificateFromCsr(string certificateSigningRequest, bool setAsActive) { var request = new CreateCertificateFromCsrRequest(); request.CertificateSigningRequest = certificateSigningRequest; request.SetAsActive = setAsActive; return CreateCertificateFromCsr(request); }
/// <summary> /// Creates an X.509 certificate using the specified certificate signing request. /// /// /// <para> /// <b>Note</b> Reusing the same certificate signing request (CSR) results in a distinct /// certificate. /// </para> /// /// <para> /// You can create multiple certificates in a batch by creating a directory and copying /// multiple .csr files into that directory and specifying that directory on the command /// line. The following commands show how to create a batch of certificates given a batch /// of CSRs. /// </para> /// /// <para> /// Assuming a set of CSRs are located inside of the directory my-csr-directory: /// </para> /// > /// <para> /// On Linux and OSX, the command is: /// </para> /// /// <para> /// $ ls my-csr-directory/ | xargs -I {} aws iot create-certificate-from-csr --certificate-signing-request /// file://my-csr-directory/{} /// </para> /// /// <para> /// This command lists all of the CSRs in my-csr-directory and pipes each CSR filename /// to the aws iot create-certificate-from-csr AWS CLI command to create a certificate /// for the corresponding CSR. /// </para> /// /// <para> /// The aws iot create-certificate-from-csr part of the command can also be run in parallel /// to speed up the certificate creation process: /// </para> /// /// <para> /// $ ls my-csr-directory/ | xargs -P 10 -I {} aws iot create-certificate-from-csr --certificate-signing-request /// file://my-csr-directory/{} /// </para> /// /// <para> /// On Windows PowerShell, the command to create certificates for all CSRs in my-csr-directory /// is: /// </para> /// /// <para> /// > ls -Name my-csr-directory | %{aws iot create-certificate-from-csr --certificate-signing-request /// file://my-csr-directory/$_} /// </para> /// /// <para> /// On Windows Command Prompt, the command to create certificates for all CSRs in my-csr-directory /// is: /// </para> /// /// <para> /// > forfiles /p my-csr-directory /c "cmd /c aws iot create-certificate-from-csr /// --certificate-signing-request file://@path" /// </para> /// </summary> /// <param name="certificateSigningRequest">The certificate signing request (CSR).</param> /// /// <returns>The response from the CreateCertificateFromCsr service method, as returned by IoT.</returns> /// <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.ServiceUnavailableException"> /// The service is temporarily unavailable. /// </exception> /// <exception cref="Amazon.IoT.Model.ThrottlingException"> /// The rate exceeds the limit. /// </exception> /// <exception cref="Amazon.IoT.Model.UnauthorizedException"> /// You are not authorized to perform this operation. /// </exception> public CreateCertificateFromCsrResponse CreateCertificateFromCsr(string certificateSigningRequest) { var request = new CreateCertificateFromCsrRequest(); request.CertificateSigningRequest = certificateSigningRequest; return CreateCertificateFromCsr(request); }
/// <summary> /// Initiates the asynchronous execution of the CreateCertificateFromCsr operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateCertificateFromCsr 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<CreateCertificateFromCsrResponse> CreateCertificateFromCsrAsync(CreateCertificateFromCsrRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateCertificateFromCsrRequestMarshaller(); var unmarshaller = CreateCertificateFromCsrResponseUnmarshaller.Instance; return InvokeAsync<CreateCertificateFromCsrRequest,CreateCertificateFromCsrResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Creates an X.509 certificate using the specified certificate signing request. /// /// /// <para> /// <b>Note</b> Reusing the same certificate signing request (CSR) results in a distinct /// certificate. /// </para> /// /// <para> /// You can create multiple certificates in a batch by creating a directory and copying /// multiple .csr files into that directory and specifying that directory on the command /// line. The following commands show how to create a batch of certificates given a batch /// of CSRs. /// </para> /// /// <para> /// Assuming a set of CSRs are located inside of the directory my-csr-directory: /// </para> /// > /// <para> /// On Linux and OSX, the command is: /// </para> /// /// <para> /// $ ls my-csr-directory/ | xargs -I {} aws iot create-certificate-from-csr --certificate-signing-request /// file://my-csr-directory/{} /// </para> /// /// <para> /// This command lists all of the CSRs in my-csr-directory and pipes each CSR filename /// to the aws iot create-certificate-from-csr AWS CLI command to create a certificate /// for the corresponding CSR. /// </para> /// /// <para> /// The aws iot create-certificate-from-csr part of the command can also be run in parallel /// to speed up the certificate creation process: /// </para> /// /// <para> /// $ ls my-csr-directory/ | xargs -P 10 -I {} aws iot create-certificate-from-csr --certificate-signing-request /// file://my-csr-directory/{} /// </para> /// /// <para> /// On Windows PowerShell, the command to create certificates for all CSRs in my-csr-directory /// is: /// </para> /// /// <para> /// > ls -Name my-csr-directory | %{aws iot create-certificate-from-csr --certificate-signing-request /// file://my-csr-directory/$_} /// </para> /// /// <para> /// On Windows Command Prompt, the command to create certificates for all CSRs in my-csr-directory /// is: /// </para> /// /// <para> /// > forfiles /p my-csr-directory /c "cmd /c aws iot create-certificate-from-csr /// --certificate-signing-request file://@path" /// </para> /// </summary> /// <param name="certificateSigningRequest">The certificate signing request (CSR).</param> /// <param name="setAsActive">Specifies whether the certificate is active.</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 CreateCertificateFromCsr service method, as returned by IoT.</returns> /// <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.ServiceUnavailableException"> /// The service is temporarily unavailable. /// </exception> /// <exception cref="Amazon.IoT.Model.ThrottlingException"> /// The rate exceeds the limit. /// </exception> /// <exception cref="Amazon.IoT.Model.UnauthorizedException"> /// You are not authorized to perform this operation. /// </exception> public Task<CreateCertificateFromCsrResponse> CreateCertificateFromCsrAsync(string certificateSigningRequest, bool setAsActive, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new CreateCertificateFromCsrRequest(); request.CertificateSigningRequest = certificateSigningRequest; request.SetAsActive = setAsActive; return CreateCertificateFromCsrAsync(request, cancellationToken); }
/// <summary> /// Creates an X.509 certificate using the specified certificate signing request. /// /// /// <para> /// <b>Note</b> Reusing the same certificate signing request (CSR) results in a distinct /// certificate. /// </para> /// /// <para> /// You can create multiple certificates in a batch by creating a directory and copying /// multiple .csr files into that directory and specifying that directory on the command /// line. The following commands show how to create a batch of certificates given a batch /// of CSRs. /// </para> /// /// <para> /// Assuming a set of CSRs are located inside of the directory my-csr-directory: /// </para> /// > /// <para> /// On Linux and OSX, the command is: /// </para> /// /// <para> /// $ ls my-csr-directory/ | xargs -I {} aws iot create-certificate-from-csr --certificate-signing-request /// file://my-csr-directory/{} /// </para> /// /// <para> /// This command lists all of the CSRs in my-csr-directory and pipes each CSR filename /// to the aws iot create-certificate-from-csr AWS CLI command to create a certificate /// for the corresponding CSR. /// </para> /// /// <para> /// The aws iot create-certificate-from-csr part of the command can also be run in parallel /// to speed up the certificate creation process: /// </para> /// /// <para> /// $ ls my-csr-directory/ | xargs -P 10 -I {} aws iot create-certificate-from-csr --certificate-signing-request /// file://my-csr-directory/{} /// </para> /// /// <para> /// On Windows PowerShell, the command to create certificates for all CSRs in my-csr-directory /// is: /// </para> /// /// <para> /// > ls -Name my-csr-directory | %{aws iot create-certificate-from-csr --certificate-signing-request /// file://my-csr-directory/$_} /// </para> /// /// <para> /// On Windows Command Prompt, the command to create certificates for all CSRs in my-csr-directory /// is: /// </para> /// /// <para> /// > forfiles /p my-csr-directory /c "cmd /c aws iot create-certificate-from-csr /// --certificate-signing-request file://@path" /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateCertificateFromCsr service method.</param> /// /// <returns>The response from the CreateCertificateFromCsr service method, as returned by IoT.</returns> /// <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.ServiceUnavailableException"> /// The service is temporarily unavailable. /// </exception> /// <exception cref="Amazon.IoT.Model.ThrottlingException"> /// The rate exceeds the limit. /// </exception> /// <exception cref="Amazon.IoT.Model.UnauthorizedException"> /// You are not authorized to perform this operation. /// </exception> public CreateCertificateFromCsrResponse CreateCertificateFromCsr(CreateCertificateFromCsrRequest request) { var marshaller = new CreateCertificateFromCsrRequestMarshaller(); var unmarshaller = CreateCertificateFromCsrResponseUnmarshaller.Instance; return Invoke<CreateCertificateFromCsrRequest,CreateCertificateFromCsrResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateCertificateFromCsr operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateCertificateFromCsr 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 EndCreateCertificateFromCsr /// operation.</returns> public IAsyncResult BeginCreateCertificateFromCsr(CreateCertificateFromCsrRequest request, AsyncCallback callback, object state) { var marshaller = new CreateCertificateFromCsrRequestMarshaller(); var unmarshaller = CreateCertificateFromCsrResponseUnmarshaller.Instance; return BeginInvoke<CreateCertificateFromCsrRequest>(request, marshaller, unmarshaller, callback, state); }