syntax = "proto3";
package rafay.dev.rpc.v3;

import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "proto/types/infrapb/v3/cluster.proto";

option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
    info: {
      title: "Location Service"
      version: "3.0"
      contact: { name: "Rafay Dev" }
    }
    schemes: HTTPS
    consumes: "application/json"
    consumes: "application/yaml"
    produces: "application/json"
    produces: "application/yaml"
    security_definitions: {
      security: {
        key: "BasicAuth"
        value: { type: TYPE_BASIC }
      }
      security: {
        key: "ApiKeyAuth"
        value: { type: TYPE_API_KEY in: IN_HEADER name: "X-RAFAY-API-KEYID" }
      }
    }
    security: {
      security_requirement: {
        key: "BasicAuth"
        value: {}
      }
      security_requirement: {
        key: "ApiKeyAuth"
        value: {}
      }
    }
    responses: {
      key: "403"
      value: {
        description: "Returned when the user does not have permission to access the resource."
      }
    }
    responses: {
      key: "404"
      value: {
        description: "Returned when the resource does not exist."
        schema: { json_schema: { type: STRING } }
      }
    }
  };
  
  service Location {
    rpc CreateLocation(rafay.dev.types.infra.v3.Location)
        returns (rafay.dev.types.infra.v3.Location) {
      option (google.api.http) = {
        post : "/infra/v3/partner/{metadata.partner}/location"
        body : "*"
      };
  
      option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
        responses : {
          key : "201"
          value : {
            description : "Returned when location is created successfully."
          }
        }
      };
    };
  
    rpc GetLocations(rafay.dev.types.infra.v3.Location)
        returns (rafay.dev.types.infra.v3.LocationList) {
      option (google.api.http) = {
        get : "/infra/v3/partner/{metadata.partner}/location"
      };
    };
  
    rpc GetLocation(rafay.dev.types.infra.v3.Location)
        returns (rafay.dev.types.infra.v3.Location) {
      option (google.api.http) = {
        get : "/infra/v3/partner/{metadata.partner}/location/{metadata.name}"
      };
    };
  
    rpc UpdateLocation(rafay.dev.types.infra.v3.Location)
        returns (rafay.dev.types.infra.v3.Location) {
      option (google.api.http) = {
        put : "/infra/v3/partner/{metadata.partner}/location/{metadata.name}"
        body : "*"
      };
    };
  
    rpc DeleteLocation(rafay.dev.types.infra.v3.Location)
        returns (rafay.dev.types.infra.v3.Location) {
      option (google.api.http) = {
        delete : "/infra/v3/partner/{metadata.partner}/location/{metadata.name}"
      };
  
      option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
        responses : {
          key : "204"
          value : {
            description : "Returned when organization is deleted successfully."
          }
        }
      };
    };
  
  }