use of com.amazonaws.services.identitymanagement.model.DeleteServerCertificateRequest in project aws-doc-sdk-examples by awsdocs.
the class DeleteServerCertificate method main.
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);
}
use of com.amazonaws.services.identitymanagement.model.DeleteServerCertificateRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class SSLSetup method deleteSSLCertificate.
/*
* Delete the SSL certificate
*/
public void deleteSSLCertificate(StackEnvironmentType env) {
ServerCertificateMetadata meta = findCertificate(config.getSSLCertificateName(env));
if (meta == null) {
// Just log
// TODO: Or throw IllegalStateException?
log.debug("Could not find SSL certificate metadata for" + config.getSSLCertificateName(env));
} else {
DeleteServerCertificateRequest request = new DeleteServerCertificateRequest();
request.setServerCertificateName(config.getSSLCertificateName(env));
iamClient.deleteServerCertificate(request);
meta = findCertificate(config.getSSLCertificateName(env));
}
if (meta != null) {
throw new IllegalStateException("Failed to delete the SSL certificate: " + config.getSSLCertificateName(env));
}
}
Aggregations