Search in sources :

Example 1 with HealthCheckConfig

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

Aggregations

CreateHealthCheckRequest (software.amazon.awssdk.services.route53.model.CreateHealthCheckRequest)1 CreateHealthCheckResponse (software.amazon.awssdk.services.route53.model.CreateHealthCheckResponse)1 HealthCheckConfig (software.amazon.awssdk.services.route53.model.HealthCheckConfig)1 Route53Exception (software.amazon.awssdk.services.route53.model.Route53Exception)1