// Copyright 2020 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.v1beta;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/cloud/gaming/v1beta/game_server_configs.proto";
import "google/longrunning/operations.proto";

option go_package = "cloud.google.com/go/gaming/apiv1beta/gamingpb;gamingpb";

option java_multiple_files = true;
option java_package = "com.google.cloud.gaming.v1beta";
option php_namespace = "Google\\Cloud\\Gaming\\V1beta";

// The game server config configures the game servers in an Agones fleet.
service GameServerConfigsService {
  option (google.api.default_host) = "gameservices.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Lists game server configs in a given project, location, and game server
  // deployment.
  rpc ListGameServerConfigs(ListGameServerConfigsRequest)
      returns (ListGameServerConfigsResponse) {
    option (google.api.http) = {
      get: "/v1beta/{parent=projects/*/locations/*/gameServerDeployments/*}/configs"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of a single game server config.
  rpc GetGameServerConfig(GetGameServerConfigRequest)
      returns (GameServerConfig) {
    option (google.api.http) = {
      get: "/v1beta/{name=projects/*/locations/*/gameServerDeployments/*/configs/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new game server config in a given project, location, and game
  // server deployment. Game server configs are immutable, and are not applied
  // until referenced in the game server deployment rollout resource.
  rpc CreateGameServerConfig(CreateGameServerConfigRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta/{parent=projects/*/locations/*/gameServerDeployments/*}/configs"
      body: "game_server_config"
    };
    option (google.api.method_signature) = "parent,game_server_config";
    option (google.longrunning.operation_info) = {
      response_type: "GameServerConfig"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a single game server config. The deletion will fail if the game
  // server config is referenced in a game server deployment rollout.
  rpc DeleteGameServerConfig(DeleteGameServerConfigRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1beta/{name=projects/*/locations/*/gameServerDeployments/*/configs/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }
}
