//command to generate gRPC code
//protoc --go_out=. --go_opt=paths=source_relative \
//--go-grpc_out=. --go-grpc_opt=paths=source_relative credentialsfetcher/credentialsfetcher.proto
// This will generate credentialsfetcher/credentialsfetcher.pb.go and credentialsfetcher/credentialsfetcher_grpc.pb.go files
syntax = "proto3";

option go_package = "gmsacredclient/credentialsfetcher";
package credentialsfetcher;

service CredentialsFetcherService {
  rpc AddKerberosLease (CreateKerberosLeaseRequest) returns (CreateKerberosLeaseResponse);
  rpc AddNonDomainJoinedKerberosLease
      (CreateNonDomainJoinedKerberosLeaseRequest)
      returns (CreateNonDomainJoinedKerberosLeaseResponse);
  rpc RenewNonDomainJoinedKerberosLease
      (RenewNonDomainJoinedKerberosLeaseRequest) returns (RenewNonDomainJoinedKerberosLeaseResponse);
  rpc DeleteKerberosLease (DeleteKerberosLeaseRequest) returns (DeleteKerberosLeaseResponse);
  rpc HealthCheck(HealthCheckRequest) returns (HealthCheckResponse);
  rpc AddKerberosArnLease (KerberosArnLeaseRequest) returns (CreateKerberosArnLeaseResponse);
  rpc RenewKerberosArnLease (RenewKerberosArnLeaseRequest) returns (RenewKerberosArnLeaseResponse);
}

message HealthCheckRequest {
  string service = 1;
}

message HealthCheckResponse {
  string status = 1;
}

message KerberosArnLeaseRequest {
  repeated string credspec_arns = 1;
  string access_key_id = 2;
  string secret_access_key = 3;
  string session_token = 4;
  string region = 5;
}

message RenewKerberosArnLeaseRequest {
  string access_key_id = 1;
  string secret_access_key = 2;
  string session_token = 3;
  string region = 4;
}

message CreateKerberosArnLeaseResponse {
  string lease_id = 1;
  repeated KerberosTicketArnResponse krb_ticket_response_map = 2;
}

message RenewKerberosArnLeaseResponse {
  string status = 1;
}

message KerberosTicketArnResponse {
  string credspec_arns = 1;
  string created_kerberos_file_paths = 2;
}

message CreateKerberosLeaseRequest {
  repeated string credspec_contents = 1;
}

message CreateKerberosLeaseResponse {
  string lease_id = 1;
  repeated string created_kerberos_file_paths = 2;
}

message CreateNonDomainJoinedKerberosLeaseRequest{
  repeated string credspec_contents = 1;
  string username = 2;
  string password = 3;
  string domain = 4;
}

message CreateNonDomainJoinedKerberosLeaseResponse{
  string lease_id = 1;
  repeated string created_kerberos_file_paths = 2;
}

message RenewNonDomainJoinedKerberosLeaseRequest{
  string username = 1;
  string password = 2;
  string domain = 3;
}

message RenewNonDomainJoinedKerberosLeaseResponse{
  repeated string renewed_kerberos_file_paths = 1;
}


message DeleteKerberosLeaseRequest {
  string lease_id = 1;
}

message DeleteKerberosLeaseResponse {
  string lease_id = 1;
  repeated string deleted_kerberos_file_paths = 2;
}