// 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/realms.proto";
import "google/longrunning/operations.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/gaming/v1beta;gaming";

option java_multiple_files = true;
option java_package = "com.google.cloud.gaming.v1beta";

// A realm is a grouping of game server clusters that are considered
// interchangeable.
service RealmsService {
  option (google.api.default_host) = "gameservices.googleapis.com";
  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";

  // Lists realms in a given project and location.
  rpc ListRealms(ListRealmsRequest) returns (ListRealmsResponse) {
    option (google.api.http) = {
      get: "/v1beta/{parent=projects/*/locations/*}/realms"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of a single realm.
  rpc GetRealm(GetRealmRequest) returns (Realm) {
    option (google.api.http) = {
      get: "/v1beta/{name=projects/*/locations/*/realms/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new realm in a given project and location.
  rpc CreateRealm(CreateRealmRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta/{parent=projects/*/locations/*}/realms"
      body: "realm"
    };
    option (google.api.method_signature) = "parent,realm,realm_id";
    option (google.longrunning.operation_info) = {
      response_type: "Realm"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a single realm.
  rpc DeleteRealm(DeleteRealmRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1beta/{name=projects/*/locations/*/realms/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Patches a single realm.
  rpc UpdateRealm(UpdateRealmRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1beta/{realm.name=projects/*/locations/*/realms/*}"
      body: "realm"
    };
    option (google.api.method_signature) = "realm,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "Realm"
      metadata_type: "OperationMetadata"
    };
  }

  // Previews patches to a single realm.
  rpc PreviewRealmUpdate(PreviewRealmUpdateRequest) returns (PreviewRealmUpdateResponse) {
    option (google.api.http) = {
      patch: "/v1beta/{realm.name=projects/*/locations/*/realms/*}:previewUpdate"
      body: "realm"
    };
  }
}
