選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

將標籤新增到憑證

焦點模式
將標籤新增到憑證 - AWS Certificate Manager

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

下面的例子演示了如何使用該AddTagsToCertificate函數。

package com.amazonaws.samples; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.regions.Regions; import com.amazonaws.services.certificatemanager.AWSCertificateManager; import com.amazonaws.services.certificatemanager.AWSCertificateManagerClientBuilder; import com.amazonaws.services.certificatemanager.model.ImportCertificateRequest; import com.amazonaws.services.certificatemanager.model.ImportCertificateResult; /** * This sample demonstrates how to use the ImportCertificate function in the AWS Certificate Manager * service. * * Input parameters: * Accesskey - AWS access key * SecretKey - AWS secret key * CertificateArn - Use to reimport a certificate (not included in this example). * region - AWS region * Certificate - PEM file that contains the certificate to import. Ex: /data/certs/servercert.pem * CertificateChain - The certificate chain, not including the end-entity certificate. * PrivateKey - The private key that matches the public key in the certificate. * * Output parameter: * CertificcateArn - The ARN of the imported certificate. * */ public class AWSCertificateManagerSample { public static void main(String[] args) throws IOException { String accessKey = ""; String secretKey = ""; String certificateArn = null; Regions region = Regions.DEFAULT_REGION; String serverCertFilePath = ""; String privateKeyFilePath = ""; String caCertFilePath = ""; ImportCertificateRequest req = new ImportCertificateRequest() .withCertificate(getCertContent(serverCertFilePath)) .withPrivateKey(getCertContent(privateKeyFilePath)) .withCertificateChain(getCertContent(caCertFilePath)).withCertificateArn(certificateArn); AWSCertificateManager client = AWSCertificateManagerClientBuilder.standard().withRegion(region) .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey))) .build(); ImportCertificateResult result = client.importCertificate(req); System.out.println(result.getCertificateArn()); List<Tag> expectedTags = ImmutableList.of(Tag.builder().withKey("key").withValue("value").build()); AddTagsToCertificateRequest addTagsToCertificateRequest = AddTagsToCertificateRequest.builder() .withCertificateArn(result.getCertificateArn()) .withTags(tags) .build(); client.addTagsToCertificate(addTagsToCertificateRequest); } private static ByteBuffer getCertContent(String filePath) throws IOException { String fileContent = new String(Files.readAllBytes(Paths.get(filePath))); return StandardCharsets.UTF_8.encode(fileContent); } }
隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。