Search in sources :

Example 1 with Route53Exception

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

the class CreateHealthCheck method createCheck.

// snippet-start:[route53.java2.create_health_check.main]
public static String createCheck(Route53Client route53Client, String domainName) {
    try {
        // You must use a unique CallerReference string
        String callerReference = java.util.UUID.randomUUID().toString();
        HealthCheckConfig config = HealthCheckConfig.builder().fullyQualifiedDomainName(domainName).port(80).type("HTTP").build();
        CreateHealthCheckRequest healthCheckRequest = CreateHealthCheckRequest.builder().callerReference(callerReference).healthCheckConfig(config).build();
        // Create the Health Check and return the id value
        CreateHealthCheckResponse healthResponse = route53Client.createHealthCheck(healthCheckRequest);
        return healthResponse.healthCheck().id();
    } catch (Route53Exception e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
    return "";
}
Also used : Route53Exception(software.amazon.awssdk.services.route53.model.Route53Exception) CreateHealthCheckRequest(software.amazon.awssdk.services.route53.model.CreateHealthCheckRequest) CreateHealthCheckResponse(software.amazon.awssdk.services.route53.model.CreateHealthCheckResponse) HealthCheckConfig(software.amazon.awssdk.services.route53.model.HealthCheckConfig)

Example 2 with Route53Exception

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

the class GetHealthCheckStatus method getHealthStatus.

// snippet-start:[route53.java2.get_health_check_status.main]
public static void getHealthStatus(Route53Client route53Client, String healthCheckId) {
    try {
        GetHealthCheckStatusRequest statusRequest = GetHealthCheckStatusRequest.builder().healthCheckId(healthCheckId).build();
        GetHealthCheckStatusResponse statusResponse = route53Client.getHealthCheckStatus(statusRequest);
        List<HealthCheckObservation> observations = statusResponse.healthCheckObservations();
        for (HealthCheckObservation observation : observations) {
            System.out.println("(The health check observation status: " + observation.statusReport().status());
        }
    } catch (Route53Exception e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : GetHealthCheckStatusRequest(software.amazon.awssdk.services.route53.model.GetHealthCheckStatusRequest) GetHealthCheckStatusResponse(software.amazon.awssdk.services.route53.model.GetHealthCheckStatusResponse) Route53Exception(software.amazon.awssdk.services.route53.model.Route53Exception) HealthCheckObservation(software.amazon.awssdk.services.route53.model.HealthCheckObservation)

Example 3 with Route53Exception

use of software.amazon.awssdk.services.route53.model.Route53Exception 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 4 with Route53Exception

use of software.amazon.awssdk.services.route53.model.Route53Exception 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 5 with Route53Exception

use of software.amazon.awssdk.services.route53.model.Route53Exception 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)

Aggregations

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 UpdateHealthCheckRequest (software.amazon.awssdk.services.route53.model.UpdateHealthCheckRequest)1 UpdateHealthCheckResponse (software.amazon.awssdk.services.route53.model.UpdateHealthCheckResponse)1