Search in sources :

Example 6 with Route53Client

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

the class DeleteHostedZone method delHostedZone.

// snippet-start:[route53.java2.delete_hosted_zone.main]
public static void delHostedZone(Route53Client route53Client, String hostedZoneId) {
    try {
        DeleteHostedZoneRequest deleteHostedZoneRequestRequest = DeleteHostedZoneRequest.builder().id(hostedZoneId).build();
        route53Client.deleteHostedZone(deleteHostedZoneRequestRequest);
        System.out.println("The hosted zone was deleted");
    } catch (Route53Exception e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : DeleteHostedZoneRequest(software.amazon.awssdk.services.route53.model.DeleteHostedZoneRequest) Route53Exception(software.amazon.awssdk.services.route53.model.Route53Exception)

Example 7 with Route53Client

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

the class DeleteHostedZone method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    <hostedZoneId> \n\n" + "Where:\n" + "    hostedZoneId - the hosted zone id. \n";
    if (args.length < 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String hostedZoneId = args[0];
    Region region = Region.AWS_GLOBAL;
    Route53Client route53Client = Route53Client.builder().region(region).build();
    delHostedZone(route53Client, hostedZoneId);
    route53Client.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) Route53Client(software.amazon.awssdk.services.route53.Route53Client)

Example 8 with Route53Client

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

the class ListHealthChecks method listAllHealthChecks.

// snippet-start:[route53.java2.list_health_checks.main]
public static void listAllHealthChecks(Route53Client route53Client) {
    try {
        ListHealthChecksResponse checksResponse = route53Client.listHealthChecks();
        List<HealthCheck> checklist = checksResponse.healthChecks();
        for (HealthCheck check : checklist) {
            System.out.println("The health check id is: " + check.id());
            System.out.println("The health threshold is: " + check.healthCheckConfig().healthThreshold());
            System.out.println("The type is: " + check.healthCheckConfig().typeAsString());
        }
    } catch (Route53Exception e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : Route53Exception(software.amazon.awssdk.services.route53.model.Route53Exception) HealthCheck(software.amazon.awssdk.services.route53.model.HealthCheck) ListHealthChecksResponse(software.amazon.awssdk.services.route53.model.ListHealthChecksResponse)

Example 9 with Route53Client

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

the class ListResourceRecordSets method listResourceRecord.

// snippet-start:[route.java2.list_records.main]
public static void listResourceRecord(Route53Client route53Client, String hostedZoneId) {
    try {
        ListResourceRecordSetsRequest request = ListResourceRecordSetsRequest.builder().hostedZoneId(hostedZoneId).maxItems("12").build();
        ListResourceRecordSetsResponse listResourceRecordSets = route53Client.listResourceRecordSets(request);
        List<ResourceRecordSet> records = listResourceRecordSets.resourceRecordSets();
        for (ResourceRecordSet record : records) {
            System.out.println("The Record name is: " + record.name());
        }
    } catch (Route53Exception e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : ResourceRecordSet(software.amazon.awssdk.services.route53.model.ResourceRecordSet) Route53Exception(software.amazon.awssdk.services.route53.model.Route53Exception) ListResourceRecordSetsRequest(software.amazon.awssdk.services.route53.model.ListResourceRecordSetsRequest) ListResourceRecordSetsResponse(software.amazon.awssdk.services.route53.model.ListResourceRecordSetsResponse)

Example 10 with Route53Client

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

the class UpdateHealthCheck method updateSpecificHealthCheck.

// snippet-start:[route53.java2.update_health_check.main]
public static void updateSpecificHealthCheck(Route53Client route53Client, String id) {
    try {
        UpdateHealthCheckRequest checkRequest = UpdateHealthCheckRequest.builder().healthCheckId(id).disabled(true).build();
        // Update the Health Check
        UpdateHealthCheckResponse healthResponse = route53Client.updateHealthCheck(checkRequest);
        System.out.println("The health check with id " + healthResponse.healthCheck().id() + " was updated!");
    } catch (Route53Exception e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : UpdateHealthCheckResponse(software.amazon.awssdk.services.route53.model.UpdateHealthCheckResponse) Route53Exception(software.amazon.awssdk.services.route53.model.Route53Exception) UpdateHealthCheckRequest(software.amazon.awssdk.services.route53.model.UpdateHealthCheckRequest)

Aggregations

Region (software.amazon.awssdk.regions.Region)9 Route53Client (software.amazon.awssdk.services.route53.Route53Client)9 Route53Exception (software.amazon.awssdk.services.route53.model.Route53Exception)9 CreateHealthCheckRequest (software.amazon.awssdk.services.route53.model.CreateHealthCheckRequest)1 CreateHealthCheckResponse (software.amazon.awssdk.services.route53.model.CreateHealthCheckResponse)1 CreateHostedZoneRequest (software.amazon.awssdk.services.route53.model.CreateHostedZoneRequest)1 CreateHostedZoneResponse (software.amazon.awssdk.services.route53.model.CreateHostedZoneResponse)1 DeleteHealthCheckRequest (software.amazon.awssdk.services.route53.model.DeleteHealthCheckRequest)1 DeleteHostedZoneRequest (software.amazon.awssdk.services.route53.model.DeleteHostedZoneRequest)1 GetHealthCheckStatusRequest (software.amazon.awssdk.services.route53.model.GetHealthCheckStatusRequest)1 GetHealthCheckStatusResponse (software.amazon.awssdk.services.route53.model.GetHealthCheckStatusResponse)1 HealthCheck (software.amazon.awssdk.services.route53.model.HealthCheck)1 HealthCheckConfig (software.amazon.awssdk.services.route53.model.HealthCheckConfig)1 HealthCheckObservation (software.amazon.awssdk.services.route53.model.HealthCheckObservation)1 HostedZone (software.amazon.awssdk.services.route53.model.HostedZone)1 ListHealthChecksResponse (software.amazon.awssdk.services.route53.model.ListHealthChecksResponse)1 ListHostedZonesResponse (software.amazon.awssdk.services.route53.model.ListHostedZonesResponse)1 ListResourceRecordSetsRequest (software.amazon.awssdk.services.route53.model.ListResourceRecordSetsRequest)1 ListResourceRecordSetsResponse (software.amazon.awssdk.services.route53.model.ListResourceRecordSetsResponse)1 ResourceRecordSet (software.amazon.awssdk.services.route53.model.ResourceRecordSet)1