Search in sources :

Example 6 with HostedZone

use of software.amazon.awssdk.services.route53.model.HostedZone in project Synapse-Stack-Builder by Sage-Bionetworks.

the class Route53SetupTest method testGetResourceRecordSetForRecordNameNoneFound.

@Test
public void testGetResourceRecordSetForRecordNameNoneFound() {
    String stack = "stack";
    String hostedZoneDomainName = stack + ".sagebase.org.";
    ListHostedZonesResult res = new ListHostedZonesResult();
    List<HostedZone> expectedHostedZones = new ArrayList<HostedZone>();
    HostedZone hz = new HostedZone().withName(hostedZoneDomainName);
    expectedHostedZones.add(hz);
    hz = new HostedZone().withName("anotherzone.sagebase.org");
    expectedHostedZones.add(hz);
    res.setHostedZones(expectedHostedZones);
    Map<ListResourceRecordSetsRequest, ListResourceRecordSetsResult> expectedResourceRecordSetsResults = TestHelper.createListExpectedListResourceRecordSetsRequestNoneFound(stack);
    when(mockClient.listHostedZones()).thenReturn(res);
    // Args for getResourceRecordSetForRecordName().listResourceRecordSets()
    for (ListResourceRecordSetsRequest req : expectedResourceRecordSetsResults.keySet()) {
        when(mockClient.listResourceRecordSets(req)).thenReturn(expectedResourceRecordSetsResults.get(req));
    }
    Route53Setup r53Setup = new Route53Setup(factory, config, resources);
    for (String svcPrefix : Arrays.asList(Constants.PREFIX_PORTAL, Constants.PREFIX_REPO, Constants.PREFIX_WORKERS)) {
        ResourceRecordSet rrs = r53Setup.getResourceRecordSetForRecordName(svcPrefix + ".stack.inst.r53.sagebase.org");
        assertTrue(rrs == null);
    }
}
Also used : HostedZone(com.amazonaws.services.route53.model.HostedZone) ResourceRecordSet(com.amazonaws.services.route53.model.ResourceRecordSet) ListResourceRecordSetsRequest(com.amazonaws.services.route53.model.ListResourceRecordSetsRequest) ArrayList(java.util.ArrayList) ListHostedZonesResult(com.amazonaws.services.route53.model.ListHostedZonesResult) ListResourceRecordSetsResult(com.amazonaws.services.route53.model.ListResourceRecordSetsResult) Test(org.junit.Test)

Example 7 with HostedZone

use of software.amazon.awssdk.services.route53.model.HostedZone in project aws-doc-sdk-examples by awsdocs.

the class ListHostedZones method listZones.

// snippet-start:[route.java2.list_zones.main]
public static void listZones(Route53Client route53Client) {
    try {
        ListHostedZonesResponse zonesResponse = route53Client.listHostedZones();
        List<HostedZone> checklist = zonesResponse.hostedZones();
        for (HostedZone check : checklist) {
            System.out.println("The name is : " + check.name());
        }
    } catch (Route53Exception e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : HostedZone(software.amazon.awssdk.services.route53.model.HostedZone) Route53Exception(software.amazon.awssdk.services.route53.model.Route53Exception) ListHostedZonesResponse(software.amazon.awssdk.services.route53.model.ListHostedZonesResponse)

Aggregations

HostedZone (com.amazonaws.services.route53.model.HostedZone)6 ListHostedZonesResult (com.amazonaws.services.route53.model.ListHostedZonesResult)6 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 ListResourceRecordSetsRequest (com.amazonaws.services.route53.model.ListResourceRecordSetsRequest)3 ListResourceRecordSetsResult (com.amazonaws.services.route53.model.ListResourceRecordSetsResult)3 ResourceRecordSet (com.amazonaws.services.route53.model.ResourceRecordSet)2 ChangeInfo (com.amazonaws.services.route53.model.ChangeInfo)1 ChangeResourceRecordSetsRequest (com.amazonaws.services.route53.model.ChangeResourceRecordSetsRequest)1 ChangeResourceRecordSetsResult (com.amazonaws.services.route53.model.ChangeResourceRecordSetsResult)1 Ignore (org.junit.Ignore)1 HostedZone (software.amazon.awssdk.services.route53.model.HostedZone)1 ListHostedZonesResponse (software.amazon.awssdk.services.route53.model.ListHostedZonesResponse)1 Route53Exception (software.amazon.awssdk.services.route53.model.Route53Exception)1