syntax = "proto3";

package yandex.cloud.ydb.v1;

import "google/api/annotations.proto";
import "yandex/cloud/ydb/v1/location.proto";
import "yandex/cloud/validation.proto";

option go_package = "github.com/yandex-cloud/go-genproto/yandex/cloud/ydb/v1;ydb";
option java_package = "yandex.cloud.api.ydb.v1";

service LocationService {
  // Returns the specified location.
  rpc Get (GetLocationRequest) returns (Location) {
    option (google.api.http) = { get: "/ydb/v1/locations/{location_id}" };
  }

  // Returns the list of available locations.
  rpc List (ListLocationsRequest) returns (ListLocationsResponse) {
     option (google.api.http) = { get: "/ydb/v1/locations" };
  }
}

message GetLocationRequest {
  // Required. ID of the location to return.
  string location_id = 1 [(required) = true];
}

message ListLocationsRequest {
  // The maximum number of results per page that should be returned. If the number of available
  // results is larger than `page_size`, the service returns a `next_page_token` that can be used
  // to get the next page of results in subsequent ListLocations requests.
  // Acceptable values are 0 to 1000, inclusive. Default value: 100.
  int64 page_size = 1 [(value) = "0-1000"];

  // Page token. Set `page_token` to the `next_page_token` returned by a previous ListLocations
  // request to get the next page of results.
  string page_token = 2 [(length) = "<=100"];
}

message ListLocationsResponse {
  // Requested list of locations.
  repeated Location locations = 1;

  // This token allows you to get the next page of results for ListLocations requests,
  // if the number of results is larger than `page_size` specified in the request.
  // To get the next page, specify the value of `next_page_token` as a value for
  // the `page_token` parameter in the next ListLocations request. Subsequent ListLocations
  // requests will have their own `next_page_token` to continue paging through the results.
  string next_page_token = 2;
}
