use of com.amazonaws.services.elasticloadbalancing.model.ConfigureHealthCheckRequest in project photon-model by vmware.
the class AWSLoadBalancerService method buildHealthCheckRequest.
private ConfigureHealthCheckRequest buildHealthCheckRequest(AWSLoadBalancerContext context) {
HealthCheckConfiguration healthCheckConfiguration = context.loadBalancerStateExpanded.routes.stream().filter(config -> config != null && config.healthCheckConfiguration != null).map(config -> config.healthCheckConfiguration).findFirst().orElse(null);
if (healthCheckConfiguration == null) {
return null;
}
// Construct the target HTTP:80/index.html
String target = healthCheckConfiguration.protocol + ":" + healthCheckConfiguration.port + healthCheckConfiguration.urlPath;
HealthCheck healthCheck = new HealthCheck().withHealthyThreshold(healthCheckConfiguration.healthyThreshold).withInterval(healthCheckConfiguration.intervalSeconds).withTarget(target).withTimeout(healthCheckConfiguration.timeoutSeconds).withUnhealthyThreshold(healthCheckConfiguration.unhealthyThreshold);
return new ConfigureHealthCheckRequest().withLoadBalancerName(context.loadBalancerStateExpanded.name).withHealthCheck(healthCheck);
}
use of com.amazonaws.services.elasticloadbalancing.model.ConfigureHealthCheckRequest in project photon-model by vmware.
the class AWSLoadBalancerService method configureHealthCheck.
private DeferredResult<AWSLoadBalancerContext> configureHealthCheck(AWSLoadBalancerContext context) {
ConfigureHealthCheckRequest request = buildHealthCheckRequest(context);
if (request == null) {
return DeferredResult.completed(context);
}
String message = "Configure a health check to AWS Load Balancer with name [" + context.loadBalancerStateExpanded.name + "].";
AWSDeferredResultAsyncHandler<ConfigureHealthCheckRequest, ConfigureHealthCheckResult> handler = new AWSDeferredResultAsyncHandler<>(this, message);
context.client.configureHealthCheckAsync(request, handler);
return handler.toDeferredResult().thenApply(ignore -> context);
}
Aggregations