private Amazon.CertificateManager.Model.ImportCertificateResponse CallAWSServiceOperation(IAmazonCertificateManager client, Amazon.CertificateManager.Model.ImportCertificateRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Certificate Manager", "ImportCertificate"); try { #if DESKTOP return(client.ImportCertificate(request)); #elif CORECLR return(client.ImportCertificateAsync(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; } }
public object Execute(ExecutorContext context) { System.IO.MemoryStream _CertificateStream = null; System.IO.MemoryStream _CertificateChainStream = null; System.IO.MemoryStream _PrivateKeyStream = null; try { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CertificateManager.Model.ImportCertificateRequest(); if (cmdletContext.Certificate != null) { _CertificateStream = new System.IO.MemoryStream(cmdletContext.Certificate); request.Certificate = _CertificateStream; } if (cmdletContext.CertificateArn != null) { request.CertificateArn = cmdletContext.CertificateArn; } if (cmdletContext.CertificateChain != null) { _CertificateChainStream = new System.IO.MemoryStream(cmdletContext.CertificateChain); request.CertificateChain = _CertificateChainStream; } if (cmdletContext.PrivateKey != null) { _PrivateKeyStream = new System.IO.MemoryStream(cmdletContext.PrivateKey); request.PrivateKey = _PrivateKeyStream; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } 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); } finally { if (_CertificateStream != null) { _CertificateStream.Dispose(); } if (_CertificateChainStream != null) { _CertificateChainStream.Dispose(); } if (_PrivateKeyStream != null) { _PrivateKeyStream.Dispose(); } } }
/// <summary> /// Imports an SSL/TLS certificate into AWS Certificate Manager (ACM) to use with <a href="http://docs.aws.amazon.com/acm/latest/userguide/acm-services.html">ACM's /// integrated AWS services</a>. /// /// <note> /// <para> /// ACM does not provide <a href="http://docs.aws.amazon.com/acm/latest/userguide/acm-renewal.html">managed /// renewal</a> for certificates that you import. /// </para> /// </note> /// <para> /// For more information about importing certificates into ACM, including the differences /// between certificates that you import and those that ACM provides, see <a href="http://docs.aws.amazon.com/acm/latest/userguide/import-certificate.html">Importing /// Certificates</a> in the <i>AWS Certificate Manager User Guide</i>. /// </para> /// /// <para> /// To import a certificate, you must provide the certificate and the matching private /// key. When the certificate is not self-signed, you must also provide a certificate /// chain. You can omit the certificate chain when importing a self-signed certificate. /// </para> /// /// <para> /// The certificate, private key, and certificate chain must be PEM-encoded. For more /// information about converting these items to PEM format, see <a href="http://docs.aws.amazon.com/acm/latest/userguide/import-certificate.html#import-certificate-troubleshooting">Importing /// Certificates Troubleshooting</a> in the <i>AWS Certificate Manager User Guide</i>. /// </para> /// /// <para> /// To import a new certificate, omit the <code>CertificateArn</code> field. Include this /// field only when you want to replace a previously imported certificate. /// </para> /// /// <para> /// This operation returns the <a href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon /// Resource Name (ARN)</a> of the imported certificate. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ImportCertificate service method.</param> /// /// <returns>The response from the ImportCertificate service method, as returned by CertificateManager.</returns> /// <exception cref="Amazon.CertificateManager.Model.LimitExceededException"> /// An ACM limit has been exceeded. For example, you may have input more domains than /// are allowed or you've requested too many certificates for your account. See the exception /// message returned by ACM to determine which limit you have violated. For more information /// about ACM limits, see the <a href="http://docs.aws.amazon.com/acm/latest/userguide/acm-limits.html">Limits</a> /// topic. /// </exception> /// <exception cref="Amazon.CertificateManager.Model.ResourceNotFoundException"> /// The specified certificate cannot be found in the caller's account, or the caller's /// account cannot be found. /// </exception> public ImportCertificateResponse ImportCertificate(ImportCertificateRequest request) { var marshaller = new ImportCertificateRequestMarshaller(); var unmarshaller = ImportCertificateResponseUnmarshaller.Instance; return Invoke<ImportCertificateRequest,ImportCertificateResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the ImportCertificate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ImportCertificate operation on AmazonCertificateManagerClient.</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 EndImportCertificate /// operation.</returns> public IAsyncResult BeginImportCertificate(ImportCertificateRequest request, AsyncCallback callback, object state) { var marshaller = new ImportCertificateRequestMarshaller(); var unmarshaller = ImportCertificateResponseUnmarshaller.Instance; return BeginInvoke<ImportCertificateRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the ImportCertificate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ImportCertificate 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<ImportCertificateResponse> ImportCertificateAsync(ImportCertificateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ImportCertificateRequestMarshaller(); var unmarshaller = ImportCertificateResponseUnmarshaller.Instance; return InvokeAsync<ImportCertificateRequest,ImportCertificateResponse>(request, marshaller, unmarshaller, cancellationToken); }