/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
syntax = "proto3";

package tradefed.feature.server;

option java_package = "com.proto.tradefed.feature";
option java_outer_classname = "TradefederationService";

option java_multiple_files = true;
option java_generic_services = true;

// A service associated with a Tradefed Instance that allows triggering some features.
service TradefedInformation {

  rpc triggerFeature(FeatureRequest) returns (FeatureResponse) {}
}

// A generic request to trigger a feature
message FeatureRequest {
  string name = 1;

  map<string, string> args = 2;

  string reference_id = 3;
}

// A generic response containing the output of the response or an error
message FeatureResponse {
  oneof response_oneof {
    // A simple response
    string response = 1;

    // A more complex response due to the request needing multiple parts.
    MultiPartResponse multi_part_response = 2;
  }

  // Field containing potential errors from the request.
  ErrorInfo errorInfo = 3;
}

message MultiPartResponse {
  repeated PartResponse response_part = 1;
}

message PartResponse {
  string key = 1;

  string value = 2;
}

message ErrorInfo {
  // An error trace.
  string error_trace = 1;
}
