public void load() { List<ServerCertificateMetadata> certs = AWS.iam.listServerCerts(ServerCert.certPath(env)); String prefix = env.name + "-"; for (ServerCertificateMetadata cert : certs) { String certName = cert.getServerCertificateName(); if (!certName.startsWith(prefix)) continue; // ignore cert not matching naming convention String resourceId = certName.substring(prefix.length()); ServerCert serverCert = resources.find(ServerCert.class, resourceId) .orElseGet(() -> resources.add(new ServerCert(resourceId))); serverCert.name = certName; serverCert.remoteCert = AWS.iam.getServerCert(cert.getServerCertificateName()); serverCert.foundInRemote(); } }
public static void main(String[] args) { final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient(); boolean done = false; ListServerCertificatesRequest request = new ListServerCertificatesRequest(); while(!done) { 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; } } }
public boolean isSSLCertificateLoaded( String certificateName ){ List<ServerCertificateMetadata> certificates = this.getCertificates(); for( ServerCertificateMetadata certificate : certificates){ if(certificate.getServerCertificateName().equals(certificateName)) { return true; } } return false; }
public String getCertificateId( String certificateName){ List<ServerCertificateMetadata> certificates = this.getCertificates(); for( ServerCertificateMetadata certificate : certificates){ if(certificate.getServerCertificateName().equals(certificateName)) { return certificate.getServerCertificateId(); } } return null; }
@Test public void testGetSSLCertificates() throws IOException { List<ServerCertificateMetadata> certs = automationAction.getCertificates(); System.out.println("Certificates: " + certs.size() ); for( ServerCertificateMetadata cert : certs) { System.out.println(cert.getServerCertificateId() + " -> " + cert.getServerCertificateName()); } }
public List<ServerCertificateMetadata> getCertificates(){ ListServerCertificatesResult listSigningCertificates = identityClient.listServerCertificates(); return listSigningCertificates.getServerCertificateMetadataList(); }
public List<ServerCertificateMetadata> listServerCerts(String path) { logger.info("list server certs, path={}", path); ListServerCertificatesResult result = iam.listServerCertificates(new ListServerCertificatesRequest().withPathPrefix(path)); return result.getServerCertificateMetadataList(); }