// Copyright 2021 Google LLC
//
// 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";

package google.cloud.gaming.v1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/cloud/gaming/v1/game_server_clusters.proto";
import "google/longrunning/operations.proto";

option go_package = "cloud.google.com/go/gaming/apiv1/gamingpb;gamingpb";
option java_multiple_files = true;
option java_package = "com.google.cloud.gaming.v1";

// The game server cluster maps to Kubernetes clusters running Agones and is
// used to manage fleets within clusters.
service GameServerClustersService {
  option (google.api.default_host) = "gameservices.googleapis.com";
  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";

  // Lists game server clusters in a given project and location.
  rpc ListGameServerClusters(ListGameServerClustersRequest) returns (ListGameServerClustersResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/realms/*}/gameServerClusters"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of a single game server cluster.
  rpc GetGameServerCluster(GetGameServerClusterRequest) returns (GameServerCluster) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/realms/*/gameServerClusters/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new game server cluster in a given project and location.
  rpc CreateGameServerCluster(CreateGameServerClusterRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/realms/*}/gameServerClusters"
      body: "game_server_cluster"
    };
    option (google.api.method_signature) = "parent,game_server_cluster,game_server_cluster_id";
    option (google.longrunning.operation_info) = {
      response_type: "GameServerCluster"
      metadata_type: "OperationMetadata"
    };
  }

  // Previews creation of a new game server cluster in a given project and
  // location.
  rpc PreviewCreateGameServerCluster(PreviewCreateGameServerClusterRequest) returns (PreviewCreateGameServerClusterResponse) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/realms/*}/gameServerClusters:previewCreate"
      body: "game_server_cluster"
    };
  }

  // Deletes a single game server cluster.
  rpc DeleteGameServerCluster(DeleteGameServerClusterRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/realms/*/gameServerClusters/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Previews deletion of a single game server cluster.
  rpc PreviewDeleteGameServerCluster(PreviewDeleteGameServerClusterRequest) returns (PreviewDeleteGameServerClusterResponse) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/realms/*/gameServerClusters/*}:previewDelete"
    };
  }

  // Patches a single game server cluster.
  rpc UpdateGameServerCluster(UpdateGameServerClusterRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{game_server_cluster.name=projects/*/locations/*/realms/*/gameServerClusters/*}"
      body: "game_server_cluster"
    };
    option (google.api.method_signature) = "game_server_cluster,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "GameServerCluster"
      metadata_type: "OperationMetadata"
    };
  }

  // Previews updating a GameServerCluster.
  rpc PreviewUpdateGameServerCluster(PreviewUpdateGameServerClusterRequest) returns (PreviewUpdateGameServerClusterResponse) {
    option (google.api.http) = {
      patch: "/v1/{game_server_cluster.name=projects/*/locations/*/realms/*/gameServerClusters/*}:previewUpdate"
      body: "game_server_cluster"
    };
  }
}
