// Copyright 2018 Istio Authors
//
// 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";
import "google/rpc/status.proto";

package istio.v1.auth;

option go_package="istio_v1_auth";

// Node agent related services
service NodeAgentService {
	// WorkloadAdded is used to notify Node Agent about a workload getting
  rpc WorkloadAdded(WorkloadInfo) returns (NodeAgentMgmtResponse);
  // WorkloadDeleted is used to notify Node Agent about a workload getting
  // added on a node.
  rpc WorkloadDeleted(WorkloadInfo) returns (NodeAgentMgmtResponse);
}

message NodeAgentMgmtResponse {
        google.rpc.Status status = 1;
}

message WorkloadInfo {
  message WorkloadAttributes {
  	// uid: Unique Id of the Workload.
  	// During delete the uid is mandatory.
  	string uid = 1;
  	// workload identifier aka name.
  	string workload = 2;
  	// namespace of the workload.
  	string namespace = 3;
  	// service account of the workload.
  	string serviceaccount = 4;
  }

  // WorkloadAttributes are the properties of the workload that a caller,
  // Flexvolume driver knows off.
  // Node agent can use them to verify the credentials of the workload.
  WorkloadAttributes attrs = 1;
  // workloadpath is where the caller has hosted a volume specific for
  // the workload. The node agent will use this directory to communicate with the
  // specific workload.
  string workloadpath = 2;
}
