/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */

option java_package = "org.apache.hadoop.yarn.proto";
option java_outer_classname = "YarnServiceProtos";
option java_generic_services = true;
option java_generate_equals_and_hash = true;

import "yarn_protos.proto";

//////////////////////////////////////////////////////
/////// AM_RM_Protocol ///////////////////////////////
//////////////////////////////////////////////////////
message RegisterApplicationMasterRequestProto {
  optional ApplicationAttemptIdProto application_attempt_id = 1;
  optional string host = 2;
  optional int32 rpc_port = 3;
  optional string tracking_url = 4;
}

message RegisterApplicationMasterResponseProto {
  optional ResourceProto minimumCapability = 1;
  optional ResourceProto maximumCapability = 2;
  repeated ApplicationACLMapProto application_ACLs = 3;
}

message FinishApplicationMasterRequestProto {
  optional ApplicationAttemptIdProto application_attempt_id = 1;
  optional string diagnostics = 2;
  optional string tracking_url = 3;
  optional FinalApplicationStatusProto final_application_status = 4;
}

message FinishApplicationMasterResponseProto {
}

message AllocateRequestProto {
  optional ApplicationAttemptIdProto application_attempt_id = 1;
  repeated ResourceRequestProto ask = 2;
  repeated ContainerIdProto release = 3;
  optional int32 response_id = 4;
  optional float progress = 5;
}

message AllocateResponseProto {
  optional AMResponseProto AM_response = 1;
  optional int32 num_cluster_nodes = 2;
}



//////////////////////////////////////////////////////
/////// client_RM_Protocol ///////////////////////////
//////////////////////////////////////////////////////

message GetNewApplicationRequestProto {
}

message GetNewApplicationResponseProto {
  optional ApplicationIdProto application_id = 1;
  optional ResourceProto minimumCapability = 2;
  optional ResourceProto maximumCapability = 3;
}

message GetApplicationReportRequestProto {
  optional ApplicationIdProto application_id = 1;
}

message GetApplicationReportResponseProto {
  optional ApplicationReportProto application_report = 1;
}

message SubmitApplicationRequestProto {
  optional ApplicationSubmissionContextProto application_submission_context= 1;
}

message SubmitApplicationResponseProto {
}

message KillApplicationRequestProto {
  optional ApplicationIdProto application_id = 1;
}

message KillApplicationResponseProto {
}

message GetClusterMetricsRequestProto {
}

message GetClusterMetricsResponseProto {
  optional YarnClusterMetricsProto cluster_metrics = 1;
}

message GetAllApplicationsRequestProto {
}

message GetAllApplicationsResponseProto {
  repeated ApplicationReportProto applications = 1;
}

message GetClusterNodesRequestProto {
}

message GetClusterNodesResponseProto {
  repeated NodeReportProto nodeReports = 1;
}

message GetQueueInfoRequestProto {
  optional string queueName = 1;
  optional bool includeApplications = 2;
  optional bool includeChildQueues = 3;
  optional bool recursive = 4;
}

message GetQueueInfoResponseProto {
  optional QueueInfoProto queueInfo = 1;
}

message GetQueueUserAclsInfoRequestProto {
}

message GetQueueUserAclsInfoResponseProto {
  repeated QueueUserACLInfoProto queueUserAcls = 1;
}


message GetDelegationTokenRequestProto {
  optional string renewer = 1; 
}

message GetDelegationTokenResponseProto {
  optional DelegationTokenProto application_token = 1;
}

//////////////////////////////////////////////////////
/////// client_NM_Protocol ///////////////////////////
//////////////////////////////////////////////////////

message StartContainerRequestProto {
  optional ContainerLaunchContextProto container_launch_context = 1;
}

message StartContainerResponseProto {
  repeated StringBytesMapProto service_response = 1;
}

message StopContainerRequestProto {
  optional ContainerIdProto container_id = 1;
}

message StopContainerResponseProto {
}

message GetContainerStatusRequestProto {
  optional ContainerIdProto container_id = 1;
}

message GetContainerStatusResponseProto {
  optional ContainerStatusProto status = 1;
}
