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 "";
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations