Search in sources :

Example 1 with DeleteServerCertificateRequest

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);
}
Also used : DeleteServerCertificateRequest(com.amazonaws.services.identitymanagement.model.DeleteServerCertificateRequest) DeleteServerCertificateResult(com.amazonaws.services.identitymanagement.model.DeleteServerCertificateResult) AmazonIdentityManagement(com.amazonaws.services.identitymanagement.AmazonIdentityManagement)

Example 2 with DeleteServerCertificateRequest

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));
    }
}
Also used : ServerCertificateMetadata(com.amazonaws.services.identitymanagement.model.ServerCertificateMetadata) DeleteServerCertificateRequest(com.amazonaws.services.identitymanagement.model.DeleteServerCertificateRequest)

Aggregations

DeleteServerCertificateRequest (com.amazonaws.services.identitymanagement.model.DeleteServerCertificateRequest)2 AmazonIdentityManagement (com.amazonaws.services.identitymanagement.AmazonIdentityManagement)1 DeleteServerCertificateResult (com.amazonaws.services.identitymanagement.model.DeleteServerCertificateResult)1 ServerCertificateMetadata (com.amazonaws.services.identitymanagement.model.ServerCertificateMetadata)1