/*
Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/

syntax = "proto3";

option java_package = "org.hyperledger.fabric.protos.peer";
option java_outer_classname = "AdminPackage";
option go_package = "github.com/hyperledger/fabric/protos/peer";

package protos;

import "google/protobuf/empty.proto";
import "common/common.proto";

// Interface exported by the server.
service Admin {
    rpc GetStatus(common.Envelope) returns (ServerStatus) {}
    rpc StartServer(common.Envelope) returns (ServerStatus) {}
    rpc GetModuleLogLevel(common.Envelope) returns (LogLevelResponse) {}
    rpc SetModuleLogLevel(common.Envelope) returns (LogLevelResponse) {}
    rpc RevertLogLevels(common.Envelope) returns (google.protobuf.Empty) {}
    rpc GetLogSpec(common.Envelope) returns (LogSpecResponse) {}
    rpc SetLogSpec(common.Envelope) returns (LogSpecResponse) {}
}

message ServerStatus {

    enum StatusCode {
        UNDEFINED = 0;
        STARTED = 1;
        STOPPED = 2;
        PAUSED = 3;
        ERROR = 4;
        UNKNOWN = 5;
    }

    StatusCode status = 1;

}
message LogLevelRequest {
	string log_module = 1;
	string log_level = 2;
}

message LogLevelResponse {
	string log_module = 1;
	string log_level = 2;
}

message LogSpecRequest {
	string log_spec = 1;
}

message LogSpecResponse {
	string log_spec = 1;
	string error = 2;
}

message AdminOperation {
    oneof content {
        LogLevelRequest logReq = 1;
        LogSpecRequest logSpecReq = 2;
    }
}
