agones.dev/agones@v1.53.0/proto/sdk/alpha/alpha.proto (about)

     1  // Copyright 2020 Google LLC All Rights Reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  syntax = "proto3";
    16  
    17  package agones.dev.sdk.alpha;
    18  option go_package = "./alpha";
    19  
    20  import "google/api/annotations.proto";
    21  import "protoc-gen-openapiv2/options/annotations.proto";
    22  
    23  option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
    24      info: {
    25          title: "alpha.proto";
    26          version: "version not set";
    27      };
    28      schemes: HTTP;
    29      consumes: "application/json";
    30      produces: "application/json";
    31  };
    32  
    33  // SDK service to be used in the GameServer SDK to the Pod Sidecar.
    34  service SDK {
    35      // PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs.
    36      //
    37      // GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now,
    38      // unless there is already an update pending, in which case the update joins that batch operation.
    39      //
    40      // PlayerConnect returns true and adds the playerID to the list of playerIDs if this playerID was not already in the
    41      // list of connected playerIDs.
    42      //
    43      // If the playerID exists within the list of connected playerIDs, PlayerConnect will return false, and the list of
    44      // connected playerIDs will be left unchanged.
    45      //
    46      // An error will be returned if the playerID was not already in the list of connected playerIDs but the player capacity for
    47      // the server has been reached. The playerID will not be added to the list of playerIDs.
    48      //
    49      // Warning: Do not use this method if you are manually managing GameServer.Status.Players.IDs and GameServer.Status.Players.Count
    50      // through the Kubernetes API, as indeterminate results will occur.
    51      rpc PlayerConnect (PlayerID) returns (Bool) {
    52          option (google.api.http) = {
    53              post: "/alpha/player/connect"
    54              body: "*"
    55          };
    56      }
    57  
    58      // Decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs.
    59      //
    60      // GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now,
    61      // unless there is already an update pending, in which case the update joins that batch operation.
    62      //
    63      // PlayerDisconnect will return true and remove the supplied playerID from the list of connected playerIDs if the
    64      // playerID value exists within the list.
    65      //
    66      // If the playerID was not in the list of connected playerIDs, the call will return false, and the connected playerID list
    67      // will be left unchanged.
    68      //
    69      // Warning: Do not use this method if you are manually managing GameServer.status.players.IDs and GameServer.status.players.Count
    70      // through the Kubernetes API, as indeterminate results will occur.
    71      rpc PlayerDisconnect (PlayerID) returns (Bool) {
    72          option (google.api.http) = {
    73              post: "/alpha/player/disconnect"
    74              body: "*"
    75          };
    76      }
    77  
    78      // Update the GameServer.Status.Players.Capacity value with a new capacity.
    79      rpc SetPlayerCapacity (Count) returns (Empty) {
    80          option (google.api.http) = {
    81              put: "/alpha/player/capacity"
    82              body: "*"
    83          };
    84      }
    85  
    86      // Retrieves the current player capacity. This is always accurate from what has been set through this SDK,
    87      // even if the value has yet to be updated on the GameServer status resource.
    88      //
    89      // If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value.
    90      rpc GetPlayerCapacity (Empty) returns (Count) {
    91          option (google.api.http) = {
    92              get: "/alpha/player/capacity"
    93          };
    94      }
    95  
    96      // Retrieves the current player count. This is always accurate from what has been set through this SDK,
    97      // even if the value has yet to be updated on the GameServer status resource.
    98      //
    99      // If GameServer.Status.Players.Count is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value.
   100      rpc GetPlayerCount (Empty) returns (Count) {
   101          option (google.api.http) = {
   102              get: "/alpha/player/count"
   103          };
   104      }
   105  
   106      // Returns if the playerID is currently connected to the GameServer. This is always accurate from what has been set through this SDK,
   107      // even if the value has yet to be updated on the GameServer status resource.
   108      //
   109      // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to determine connected status.
   110      rpc IsPlayerConnected (PlayerID) returns (Bool) {
   111          option (google.api.http) = {
   112              get: "/alpha/player/connected/{playerID}"
   113          };
   114      }
   115  
   116      // Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK,
   117      // even if the value has yet to be updated on the GameServer status resource.
   118      //
   119      // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value.
   120      rpc GetConnectedPlayers(Empty) returns (PlayerIDList) {
   121          option (google.api.http) = {
   122              get: "/alpha/player/connected"
   123          };
   124      }
   125  }
   126  
   127  // I am Empty
   128  message Empty {
   129  }
   130  
   131  // Store a count variable.
   132  message Count {
   133      int64 count = 1;
   134  }
   135  
   136  // Store a boolean result
   137  message Bool {
   138      bool bool = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {format: "boolean"}];
   139  }
   140  
   141  // The unique identifier for a given player.
   142  message PlayerID {
   143      string playerID = 1;
   144  }
   145  
   146  // List of Player IDs
   147  message PlayerIDList {
   148      repeated string list = 1;
   149  }