Search in sources :

Example 11 with TargetGroupConfigDbWrapper

use of com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroupConfigDbWrapper in project cloudbreak by hortonworks.

the class LoadBalancerConfigConverter method buildGcpConfig.

private TargetGroupConfigDbWrapper buildGcpConfig(GcpLoadBalancerMetadataView gcpMetadata, TargetGroup targetGroup) {
    Set<Integer> trafficPorts = getTrafficPorts(targetGroup);
    TargetGroupConfigDbWrapper targetGroupConfigDbWrapper = new TargetGroupConfigDbWrapper();
    GcpTargetGroupConfigDb gcpTargetGroupConfigDb = new GcpTargetGroupConfigDb();
    for (Integer port : trafficPorts) {
        GcpLoadBalancerNamesDb namesDb = new GcpLoadBalancerNamesDb();
        namesDb.setInstanceGroupName(gcpMetadata.getInstanceGroupByPort(port));
        namesDb.setBackendServiceName(gcpMetadata.getBackendServiceByPort(port));
        gcpTargetGroupConfigDb.addPortNameMapping(port, namesDb);
    }
    targetGroupConfigDbWrapper.setGcpConfig(gcpTargetGroupConfigDb);
    return targetGroupConfigDbWrapper;
}
Also used : GcpLoadBalancerNamesDb(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.gcp.GcpLoadBalancerNamesDb) TargetGroupConfigDbWrapper(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroupConfigDbWrapper) GcpTargetGroupConfigDb(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.gcp.GcpTargetGroupConfigDb)

Example 12 with TargetGroupConfigDbWrapper

use of com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroupConfigDbWrapper in project cloudbreak by hortonworks.

the class LoadBalancerToLoadBalancerResponseConverterTest method creatGcpTargetGroups.

private Set<TargetGroup> creatGcpTargetGroups() {
    GcpTargetGroupConfigDb gcpTargetGroupConfigDb = new GcpTargetGroupConfigDb();
    GcpLoadBalancerNamesDb gcpLoadBalancerNamesDb = new GcpLoadBalancerNamesDb();
    gcpLoadBalancerNamesDb.setBackendServiceName(GCP_BACKEND_SERVICE_NAME);
    gcpLoadBalancerNamesDb.setInstanceGroupName(GCP_INSTANCE_GROUP_NAME);
    gcpTargetGroupConfigDb.addPortNameMapping(PORT, gcpLoadBalancerNamesDb);
    TargetGroupConfigDbWrapper targetGroupConfigDbWrapper = new TargetGroupConfigDbWrapper();
    targetGroupConfigDbWrapper.setGcpConfig(gcpTargetGroupConfigDb);
    TargetGroup targetGroup = new TargetGroup();
    targetGroup.setProviderConfig(targetGroupConfigDbWrapper);
    return Set.of(targetGroup);
}
Also used : GcpLoadBalancerNamesDb(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.gcp.GcpLoadBalancerNamesDb) TargetGroupConfigDbWrapper(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroupConfigDbWrapper) TargetGroup(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroup) GcpTargetGroupConfigDb(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.gcp.GcpTargetGroupConfigDb)

Example 13 with TargetGroupConfigDbWrapper

use of com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroupConfigDbWrapper in project cloudbreak by hortonworks.

the class LoadBalancerToLoadBalancerResponseConverterTest method createAzureTargetGroups.

private Set<TargetGroup> createAzureTargetGroups() {
    AzureTargetGroupConfigDb azureTargetGroupConfigDb = new AzureTargetGroupConfigDb();
    azureTargetGroupConfigDb.setPortAvailabilitySetMapping(Map.of(PORT, List.of(AZURE_AS_NAME)));
    TargetGroupConfigDbWrapper targetGroupConfigDbWrapper = new TargetGroupConfigDbWrapper();
    targetGroupConfigDbWrapper.setAzureConfig(azureTargetGroupConfigDb);
    TargetGroup targetGroup = new TargetGroup();
    targetGroup.setProviderConfig(targetGroupConfigDbWrapper);
    return Set.of(targetGroup);
}
Also used : TargetGroupConfigDbWrapper(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroupConfigDbWrapper) TargetGroup(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroup) AzureTargetGroupConfigDb(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.azure.AzureTargetGroupConfigDb)

Aggregations

TargetGroupConfigDbWrapper (com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroupConfigDbWrapper)13 TargetGroup (com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroup)10 TargetGroupPortPair (com.sequenceiq.cloudbreak.cloud.model.TargetGroupPortPair)7 CloudLoadBalancerMetadata (com.sequenceiq.cloudbreak.cloud.model.CloudLoadBalancerMetadata)6 AwsTargetGroupConfigDb (com.sequenceiq.cloudbreak.domain.stack.loadbalancer.aws.AwsTargetGroupConfigDb)6 Test (org.junit.Test)6 AwsTargetGroupArnsDb (com.sequenceiq.cloudbreak.domain.stack.loadbalancer.aws.AwsTargetGroupArnsDb)5 AzureTargetGroupConfigDb (com.sequenceiq.cloudbreak.domain.stack.loadbalancer.azure.AzureTargetGroupConfigDb)5 GcpLoadBalancerNamesDb (com.sequenceiq.cloudbreak.domain.stack.loadbalancer.gcp.GcpLoadBalancerNamesDb)4 GcpTargetGroupConfigDb (com.sequenceiq.cloudbreak.domain.stack.loadbalancer.gcp.GcpTargetGroupConfigDb)4 AwsLoadBalancerResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.loadbalancer.AwsLoadBalancerResponse)1 AwsTargetGroupResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.loadbalancer.AwsTargetGroupResponse)1 AzureLoadBalancerResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.loadbalancer.AzureLoadBalancerResponse)1 AzureTargetGroupResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.loadbalancer.AzureTargetGroupResponse)1 GcpLoadBalancerResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.loadbalancer.GcpLoadBalancerResponse)1 GcpTargetGroupResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.loadbalancer.GcpTargetGroupResponse)1 LoadBalancerResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.loadbalancer.LoadBalancerResponse)1 TargetGroupResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.loadbalancer.TargetGroupResponse)1 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)1 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)1