Search in sources :

Example 1 with FitAction

use of com.netflix.titus.common.framework.fit.FitAction in project titus-control-plane by Netflix.

the class DefaultFitInjection method getAction.

@Override
public FitAction getAction(String actionId) {
    FitAction action = actions.get(actionId);
    Preconditions.checkArgument(action != null, "Action %s not found", actionId);
    return action;
}
Also used : FitAction(com.netflix.titus.common.framework.fit.FitAction)

Example 2 with FitAction

use of com.netflix.titus.common.framework.fit.FitAction in project titus-control-plane by Netflix.

the class FitSpringResource method addAction.

@RequestMapping(method = RequestMethod.POST, path = "/actions", consumes = "application/json")
public Response addAction(@RequestBody Fit.AddAction request) {
    FitComponent fitComponent = FitUtil.getFitComponentOrFail(fitFramework, request.getComponentId());
    FitInjection fitInjection = FitUtil.getFitInjectionOrFail(request.getInjectionId(), fitComponent);
    Function<FitInjection, FitAction> fitActionFactory = fitFramework.getFitRegistry().newFitActionFactory(request.getActionKind(), request.getActionId(), request.getPropertiesMap());
    fitInjection.addAction(fitActionFactory.apply(fitInjection));
    return Response.noContent().build();
}
Also used : FitInjection(com.netflix.titus.common.framework.fit.FitInjection) FitComponent(com.netflix.titus.common.framework.fit.FitComponent) FitAction(com.netflix.titus.common.framework.fit.FitAction) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with FitAction

use of com.netflix.titus.common.framework.fit.FitAction in project titus-control-plane by Netflix.

the class FitResource method addAction.

@POST
@Path("/actions")
public Response addAction(Fit.AddAction request) {
    FitComponent fitComponent = FitUtil.getFitComponentOrFail(fitFramework, request.getComponentId());
    FitInjection fitInjection = FitUtil.getFitInjectionOrFail(request.getInjectionId(), fitComponent);
    Function<FitInjection, FitAction> fitActionFactory = fitFramework.getFitRegistry().newFitActionFactory(request.getActionKind(), request.getActionId(), request.getPropertiesMap());
    fitInjection.addAction(fitActionFactory.apply(fitInjection));
    return Response.noContent().build();
}
Also used : FitInjection(com.netflix.titus.common.framework.fit.FitInjection) FitComponent(com.netflix.titus.common.framework.fit.FitComponent) FitAction(com.netflix.titus.common.framework.fit.FitAction) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Aggregations

FitAction (com.netflix.titus.common.framework.fit.FitAction)3 FitComponent (com.netflix.titus.common.framework.fit.FitComponent)2 FitInjection (com.netflix.titus.common.framework.fit.FitInjection)2 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1