翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
証明書の削除
次の例は、DeleteCertificate 機能を使用する方法を示しています。成功した場合、関数は空のセット {}
を返します。
package com.amazonaws.samples; import com.amazonaws.services.certificatemanager.AWSCertificateManagerClientBuilder; import com.amazonaws.services.certificatemanager.AWSCertificateManager; import com.amazonaws.services.certificatemanager.model.DeleteCertificateRequest; import com.amazonaws.services.certificatemanager.model.DeleteCertificateResult; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.regions.Regions; import com.amazonaws.services.certificatemanager.model.InvalidArnException; import com.amazonaws.services.certificatemanager.model.ResourceInUseException; import com.amazonaws.services.certificatemanager.model.ResourceNotFoundException; import com.amazonaws.AmazonClientException; /** * This sample demonstrates how to use the DeleteCertificate function in the AWS Certificate * Manager service. * * Input parameter: * CertificateArn - The ARN of the certificate to delete. * */ public class AWSCertificateManagerExample { public static void main(String[] args) throws Exception{ // Retrieve your credentials from the C:\Users\name\.aws\credentials file in Windows // or the ~/.aws/credentials file in Linux. AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider().getCredentials(); } catch (Exception ex) { throw new AmazonClientException("Cannot load the credentials from file.", ex); } // Create a client. AWSCertificateManager client = AWSCertificateManagerClientBuilder.standard() .withRegion(Regions.
US_EAST_1
) .withCredentials(new AWSStaticCredentialsProvider(credentials)) .build(); // Create a request object and specify the ARN of the certificate to delete. DeleteCertificateRequest req = new DeleteCertificateRequest(); req.setCertificateArn("arn:aws:acm:region
:account
:certificate/12345678-1234-1234-1234-123456789012
"); // Delete the specified certificate. DeleteCertificateResult result = null; try { result = client.deleteCertificate(req); } catch (InvalidArnException ex) { throw ex; } catch (ResourceInUseException ex) { throw ex; } catch (ResourceNotFoundException ex) { throw ex; } // Display the result. System.out.println(result); } }