Search in sources :

Example 1 with HealthCheck

use of com.amazonaws.services.elasticloadbalancing.model.HealthCheck 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);
}
Also used : CreateLoadBalancerResult(com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerResult) Protocol(com.vmware.photon.controller.model.resources.SecurityGroupService.Protocol) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) RegisterInstancesWithLoadBalancerRequest(com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerRequest) ServiceTypeCluster(com.vmware.photon.controller.model.util.ClusterUtil.ServiceTypeCluster) CreateLoadBalancerRequest(com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerRequest) AWSClientManagerFactory.returnClientManager(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSClientManagerFactory.returnClientManager) LoadBalancerState(com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState) SubnetState(com.vmware.photon.controller.model.resources.SubnetService.SubnetState) URI(java.net.URI) AWSClientManager(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSClientManager) HealthCheckConfiguration(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration) StatelessService(com.vmware.xenon.common.StatelessService) DeleteLoadBalancerRequest(com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerRequest) Instance(com.amazonaws.services.elasticloadbalancing.model.Instance) Collection(java.util.Collection) TaskManager(com.vmware.photon.controller.model.adapters.util.TaskManager) Collectors(java.util.stream.Collectors) AmazonElasticLoadBalancingAsyncClient(com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingAsyncClient) List(java.util.List) DeferredResult(com.vmware.xenon.common.DeferredResult) UriUtils(com.vmware.xenon.common.UriUtils) DeregisterInstancesFromLoadBalancerResult(com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerResult) AWSDeferredResultAsyncHandler(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSDeferredResultAsyncHandler) FACTORY_LINK(com.vmware.photon.controller.model.resources.SecurityGroupService.FACTORY_LINK) SecurityGroupInstanceRequest(com.vmware.photon.controller.model.adapterapi.SecurityGroupInstanceRequest) ConfigureHealthCheckResult(com.amazonaws.services.elasticloadbalancing.model.ConfigureHealthCheckResult) ComputeProperties(com.vmware.photon.controller.model.ComputeProperties) ConfigureHealthCheckRequest(com.amazonaws.services.elasticloadbalancing.model.ConfigureHealthCheckRequest) NETWORK_STATE_ID_PROP_NAME(com.vmware.photon.controller.model.tasks.ProvisionSecurityGroupTaskService.NETWORK_STATE_ID_PROP_NAME) HashMap(java.util.HashMap) DescribeLoadBalancersRequest(com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersRequest) RegisterInstancesWithLoadBalancerResult(com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerResult) HealthCheck(com.amazonaws.services.elasticloadbalancing.model.HealthCheck) ArrayList(java.util.ArrayList) SecurityGroupState(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState) Rule(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState.Rule) HashSet(java.util.HashSet) LoadBalancerDescription(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription) Listener(com.amazonaws.services.elasticloadbalancing.model.Listener) InstanceRequestType(com.vmware.photon.controller.model.adapterapi.SecurityGroupInstanceRequest.InstanceRequestType) ResourceState(com.vmware.photon.controller.model.resources.ResourceState) DeregisterInstancesFromLoadBalancerRequest(com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest) LoadBalancerStateExpanded(com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerStateExpanded) Operation(com.vmware.xenon.common.Operation) DeleteLoadBalancerResult(com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerResult) ClusterUtil(com.vmware.photon.controller.model.util.ClusterUtil) DescribeLoadBalancersResult(com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult) LoadBalancerInstanceRequest(com.vmware.photon.controller.model.adapterapi.LoadBalancerInstanceRequest) AWSClientManagerFactory(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSClientManagerFactory) NetworkState(com.vmware.photon.controller.model.resources.NetworkService.NetworkState) Collections(java.util.Collections) PhotonModelUriUtils.createInventoryUri(com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri) HealthCheckConfiguration(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration) HealthCheck(com.amazonaws.services.elasticloadbalancing.model.HealthCheck) ConfigureHealthCheckRequest(com.amazonaws.services.elasticloadbalancing.model.ConfigureHealthCheckRequest)

Aggregations

AmazonElasticLoadBalancingAsyncClient (com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingAsyncClient)1 ConfigureHealthCheckRequest (com.amazonaws.services.elasticloadbalancing.model.ConfigureHealthCheckRequest)1 ConfigureHealthCheckResult (com.amazonaws.services.elasticloadbalancing.model.ConfigureHealthCheckResult)1 CreateLoadBalancerRequest (com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerRequest)1 CreateLoadBalancerResult (com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerResult)1 DeleteLoadBalancerRequest (com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerRequest)1 DeleteLoadBalancerResult (com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerResult)1 DeregisterInstancesFromLoadBalancerRequest (com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest)1 DeregisterInstancesFromLoadBalancerResult (com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerResult)1 DescribeLoadBalancersRequest (com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersRequest)1 DescribeLoadBalancersResult (com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult)1 HealthCheck (com.amazonaws.services.elasticloadbalancing.model.HealthCheck)1 Instance (com.amazonaws.services.elasticloadbalancing.model.Instance)1 Listener (com.amazonaws.services.elasticloadbalancing.model.Listener)1 RegisterInstancesWithLoadBalancerRequest (com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerRequest)1 RegisterInstancesWithLoadBalancerResult (com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerResult)1 ComputeProperties (com.vmware.photon.controller.model.ComputeProperties)1 LoadBalancerInstanceRequest (com.vmware.photon.controller.model.adapterapi.LoadBalancerInstanceRequest)1 SecurityGroupInstanceRequest (com.vmware.photon.controller.model.adapterapi.SecurityGroupInstanceRequest)1 InstanceRequestType (com.vmware.photon.controller.model.adapterapi.SecurityGroupInstanceRequest.InstanceRequestType)1