Search in sources :

Example 1 with BaragonService

use of com.hubspot.baragon.models.BaragonService in project Singularity by HubSpot.

the class LoadBalancerClientImpl method delete.

@Override
public SingularityLoadBalancerUpdate delete(LoadBalancerRequestId loadBalancerRequestId, String requestId, Set<String> loadBalancerGroups, String serviceBasePath) {
    final BaragonService lbService = new BaragonService(requestId, Collections.<String>emptyList(), serviceBasePath, loadBalancerGroups, Collections.<String, Object>emptyMap());
    final BaragonRequest loadBalancerRequest = new BaragonRequest(loadBalancerRequestId.toString(), lbService, Collections.<UpstreamInfo>emptyList(), Collections.<UpstreamInfo>emptyList(), Collections.<UpstreamInfo>emptyList(), Optional.<String>absent(), Optional.of(RequestAction.DELETE));
    return sendBaragonRequest(loadBalancerRequestId, loadBalancerRequest, LoadBalancerMethod.DELETE);
}
Also used : BaragonService(com.hubspot.baragon.models.BaragonService) BaragonRequest(com.hubspot.baragon.models.BaragonRequest)

Example 2 with BaragonService

use of com.hubspot.baragon.models.BaragonService in project Singularity by HubSpot.

the class LoadBalancerClientImpl method enqueue.

@Override
public SingularityLoadBalancerUpdate enqueue(LoadBalancerRequestId loadBalancerRequestId, SingularityRequest request, SingularityDeploy deploy, List<SingularityTask> add, List<SingularityTask> remove) {
    final List<String> serviceOwners = request.getOwners().or(Collections.<String>emptyList());
    final Set<String> loadBalancerGroups = deploy.getLoadBalancerGroups().or(Collections.<String>emptySet());
    final BaragonService lbService = new BaragonService(deploy.getLoadBalancerServiceIdOverride().or(request.getId()), serviceOwners, deploy.getServiceBasePath().get(), deploy.getLoadBalancerAdditionalRoutes().or(Collections.<String>emptyList()), loadBalancerGroups, deploy.getLoadBalancerOptions().orNull(), deploy.getLoadBalancerTemplate(), deploy.getLoadBalancerDomains().or(Collections.<String>emptySet()));
    final List<UpstreamInfo> addUpstreams = tasksToUpstreams(add, loadBalancerRequestId.toString(), deploy.getLoadBalancerUpstreamGroup());
    final List<UpstreamInfo> removeUpstreams = tasksToUpstreams(remove, loadBalancerRequestId.toString(), deploy.getLoadBalancerUpstreamGroup());
    final BaragonRequest loadBalancerRequest = new BaragonRequest(loadBalancerRequestId.toString(), lbService, addUpstreams, removeUpstreams);
    return sendBaragonRequest(loadBalancerRequestId, loadBalancerRequest, LoadBalancerMethod.ENQUEUE);
}
Also used : BaragonService(com.hubspot.baragon.models.BaragonService) UpstreamInfo(com.hubspot.baragon.models.UpstreamInfo) BaragonRequest(com.hubspot.baragon.models.BaragonRequest)

Aggregations

BaragonRequest (com.hubspot.baragon.models.BaragonRequest)2 BaragonService (com.hubspot.baragon.models.BaragonService)2 UpstreamInfo (com.hubspot.baragon.models.UpstreamInfo)1