public static void main(String[] args) { final String USAGE = "To run this example, supply a certificate name\n" + "Ex: DeleteServerCertificate <certificate-name>\n"; if (args.length != 1) { System.out.println(USAGE); System.exit(1); } String cert_name = args[0]; final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient(); DeleteServerCertificateRequest request = new DeleteServerCertificateRequest() .withServerCertificateName(cert_name); DeleteServerCertificateResult response = iam.deleteServerCertificate(request); System.out.println("Successfully deleted server certificate " + cert_name); }
public void deleteServerCert(String name) throws Exception { logger.info("delete server cert, name={}", name); // after delete ELB listener, it may not be visible to IAM immediately new Runner<Void>() .maxAttempts(3) .retryInterval(Duration.ofSeconds(20)) .retryOn(e -> e instanceof AmazonServiceException && "DeleteConflict".equals(((AmazonServiceException) e).getErrorCode())) .run(() -> { iam.deleteServerCertificate(new DeleteServerCertificateRequest(name)); return null; }); }
/** * Deletes the server certificate. * * @param name The server certificate name */ public void deleteServerCertificate(final String name) { client.deleteServerCertificate(new DeleteServerCertificateRequest().withServerCertificateName(name)); }