use of com.amazonaws.services.rds.model.DescribeCertificatesRequest in project cloudbreak by hortonworks.
the class AmazonRdsClientTest method describeCertificatesTestSimple.
@Test
void describeCertificatesTestSimple() {
DescribeCertificatesRequest describeCertificatesRequest = mock(DescribeCertificatesRequest.class);
DescribeCertificatesResult describeCertificatesResult = mock(DescribeCertificatesResult.class);
Certificate cert1 = mock(Certificate.class);
Certificate cert2 = mock(Certificate.class);
when(describeCertificatesResult.getMarker()).thenReturn(null);
when(describeCertificatesResult.getCertificates()).thenReturn(List.of(cert1, cert2));
when(client.describeCertificates(describeCertificatesRequest)).thenReturn(describeCertificatesResult);
List<Certificate> certificates = underTest.describeCertificates(describeCertificatesRequest);
assertThat(certificates).isNotNull();
assertThat(certificates).isEqualTo(List.of(cert1, cert2));
}
use of com.amazonaws.services.rds.model.DescribeCertificatesRequest in project cloudbreak by hortonworks.
the class AmazonRdsClientTest method describeCertificatesTestWithPaging.
@Test
void describeCertificatesTestWithPaging() {
DescribeCertificatesRequest describeCertificatesRequest = mock(DescribeCertificatesRequest.class);
DescribeCertificatesResult describeCertificatesResult1 = mock(DescribeCertificatesResult.class);
Certificate cert1 = mock(Certificate.class);
when(describeCertificatesResult1.getMarker()).thenReturn(MARKER);
when(describeCertificatesResult1.getCertificates()).thenReturn(List.of(cert1));
DescribeCertificatesResult describeCertificatesResult2 = mock(DescribeCertificatesResult.class);
Certificate cert2 = mock(Certificate.class);
when(describeCertificatesResult2.getMarker()).thenReturn(null);
when(describeCertificatesResult2.getCertificates()).thenReturn(List.of(cert2));
when(client.describeCertificates(describeCertificatesRequest)).thenReturn(describeCertificatesResult1, describeCertificatesResult2);
List<Certificate> certificates = underTest.describeCertificates(describeCertificatesRequest);
assertThat(certificates).isNotNull();
assertThat(certificates).isEqualTo(List.of(cert1, cert2));
}
use of com.amazonaws.services.rds.model.DescribeCertificatesRequest in project cloudbreak by hortonworks.
the class AwsPlatformResources method databaseServerGeneralSslRootCertificates.
@Override
public CloudDatabaseServerSslCertificates databaseServerGeneralSslRootCertificates(CloudCredential cloudCredential, Region region) {
requireNonNull(cloudCredential);
requireNonNull(region);
AmazonRdsClient rdsClient = getAmazonRdsClient(cloudCredential, region);
List<Certificate> certificates = rdsClient.describeCertificates(new DescribeCertificatesRequest());
Set<CloudDatabaseServerSslCertificate> sslCertificates = certificates.stream().map(Certificate::getCertificateIdentifier).map(id -> new CloudDatabaseServerSslCertificate(CloudDatabaseServerSslCertificateType.ROOT, id)).collect(Collectors.toSet());
return new CloudDatabaseServerSslCertificates(sslCertificates);
}
Aggregations