Search in sources :

Example 1 with RestartAction

use of com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.RestartAction in project vespa by vespa-engine.

the class ApplicationApiHandler method toSlime.

private Slime toSlime(ActivateResult result) {
    Slime slime = new Slime();
    Cursor object = slime.setObject();
    object.setString("revisionId", result.revisionId().id());
    object.setLong("applicationZipSize", result.applicationZipSizeBytes());
    Cursor logArray = object.setArray("prepareMessages");
    if (result.prepareResponse().log != null) {
        for (Log logMessage : result.prepareResponse().log) {
            Cursor logObject = logArray.addObject();
            logObject.setLong("time", logMessage.time);
            logObject.setString("level", logMessage.level);
            logObject.setString("message", logMessage.message);
        }
    }
    Cursor changeObject = object.setObject("configChangeActions");
    Cursor restartActionsArray = changeObject.setArray("restart");
    for (RestartAction restartAction : result.prepareResponse().configChangeActions.restartActions) {
        Cursor restartActionObject = restartActionsArray.addObject();
        restartActionObject.setString("clusterName", restartAction.clusterName);
        restartActionObject.setString("clusterType", restartAction.clusterType);
        restartActionObject.setString("serviceType", restartAction.serviceType);
        serviceInfosToSlime(restartAction.services, restartActionObject.setArray("services"));
        stringsToSlime(restartAction.messages, restartActionObject.setArray("messages"));
    }
    Cursor refeedActionsArray = changeObject.setArray("refeed");
    for (RefeedAction refeedAction : result.prepareResponse().configChangeActions.refeedActions) {
        Cursor refeedActionObject = refeedActionsArray.addObject();
        refeedActionObject.setString("name", refeedAction.name);
        refeedActionObject.setBool("allowed", refeedAction.allowed);
        refeedActionObject.setString("documentType", refeedAction.documentType);
        refeedActionObject.setString("clusterName", refeedAction.clusterName);
        serviceInfosToSlime(refeedAction.services, refeedActionObject.setArray("services"));
        stringsToSlime(refeedAction.messages, refeedActionObject.setArray("messages"));
    }
    return slime;
}
Also used : Log(com.yahoo.vespa.hosted.controller.api.integration.configserver.Log) RestartAction(com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.RestartAction) RefeedAction(com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.RefeedAction) Slime(com.yahoo.slime.Slime) Cursor(com.yahoo.slime.Cursor)

Aggregations

Cursor (com.yahoo.slime.Cursor)1 Slime (com.yahoo.slime.Slime)1 RefeedAction (com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.RefeedAction)1 RestartAction (com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.RestartAction)1 Log (com.yahoo.vespa.hosted.controller.api.integration.configserver.Log)1