use of com.amazonaws.services.identitymanagement.model.ListServerCertificatesRequest in project aws-doc-sdk-examples by awsdocs.
the class ListServerCertificates method main.
public static void main(String[] args) {
final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();
boolean done = false;
while (!done) {
ListServerCertificatesRequest request = new ListServerCertificatesRequest();
ListServerCertificatesResult response = iam.listServerCertificates(request);
for (ServerCertificateMetadata metadata : response.getServerCertificateMetadataList()) {
System.out.printf("Retrieved server certificate %s", metadata.getServerCertificateName());
}
request.setMarker(response.getMarker());
if (!response.getIsTruncated()) {
done = true;
}
}
}
use of com.amazonaws.services.identitymanagement.model.ListServerCertificatesRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class SSLSetup method findCertificate.
/**
* Determine if the certificate already exists
* @param certName
* @return
*/
public ServerCertificateMetadata findCertificate(String certName) {
log.debug("Searching for Certificate: " + certName);
// First we need to get all certificates
List<ServerCertificateMetadata> allCerts = new LinkedList<ServerCertificateMetadata>();
ListServerCertificatesResult results = iamClient.listServerCertificates();
allCerts.addAll(results.getServerCertificateMetadataList());
while (results.getMarker() != null) {
results = iamClient.listServerCertificates(new ListServerCertificatesRequest().withMarker(results.getMarker()));
allCerts.addAll(results.getServerCertificateMetadataList());
}
// Check if our cert is in the list.
for (ServerCertificateMetadata meta : allCerts) {
if (meta.getServerCertificateName().equals(certName)) {
log.debug("Certificate found: " + certName);
return meta;
}
}
// Did not find the cert.
return null;
}
Aggregations