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

     1  // Copyright 2017 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;
    18  option go_package = "./sdk";
    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: "sdk.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      // Call when the GameServer is ready
    36      rpc Ready (Empty) returns (Empty) {
    37          option (google.api.http) = {
    38              post: "/ready"
    39              body: "*"
    40          };
    41      }
    42  
    43      // Call to self Allocation the GameServer
    44      rpc Allocate(Empty) returns (Empty) {
    45          option (google.api.http) = {
    46              post: "/allocate"
    47              body: "*"
    48          };
    49      }
    50  
    51      // Call when the GameServer is shutting down
    52      rpc Shutdown (Empty) returns (Empty) {
    53          option (google.api.http) = {
    54              post: "/shutdown"
    55              body: "*"
    56          };
    57      }
    58      // Send a Empty every d Duration to declare that this GameSever is healthy
    59      rpc Health (stream Empty) returns (Empty) {
    60          option (google.api.http) = {
    61              post: "/health"
    62              body: "*"
    63          };
    64      }
    65      // Retrieve the current GameServer data
    66      rpc GetGameServer (Empty) returns (GameServer) {
    67          option (google.api.http) = {
    68              get: "/gameserver"
    69          };
    70      }
    71      // Send GameServer details whenever the GameServer is updated
    72      rpc WatchGameServer (Empty) returns (stream GameServer) {
    73          option (google.api.http) = {
    74              get: "/watch/gameserver"
    75          };
    76      }
    77  
    78      // Apply a Label to the backing GameServer metadata
    79      rpc SetLabel(KeyValue) returns (Empty) {
    80          option (google.api.http) = {
    81              put: "/metadata/label"
    82              body: "*"
    83          };
    84      }
    85  
    86      // Apply a Annotation to the backing GameServer metadata
    87      rpc SetAnnotation(KeyValue) returns (Empty) {
    88          option (google.api.http) = {
    89              put: "/metadata/annotation"
    90              body: "*"
    91          };
    92      }
    93  
    94      // Marks the GameServer as the Reserved state for Duration
    95      rpc Reserve(Duration) returns (Empty) {
    96          option (google.api.http) = {
    97              post: "/reserve"
    98              body: "*"
    99          };
   100      }
   101  }
   102  
   103  // I am Empty
   104  message Empty {
   105  }
   106  
   107  // Key, Value entry
   108  message KeyValue {
   109      string key = 1;
   110      string value = 2;
   111  }
   112  
   113  // time duration, in seconds
   114  message Duration {
   115      int64 seconds = 1;
   116  }
   117  
   118  // A GameServer Custom Resource Definition object
   119  // We will only export those resources that make the most
   120  // sense. Can always expand to more as needed.
   121  message GameServer {
   122      ObjectMeta object_meta = 1;
   123      Spec spec = 2;
   124      Status status = 3;
   125  
   126      // representation of the K8s ObjectMeta resource
   127      message ObjectMeta {
   128          string name = 1;
   129          string namespace = 2;
   130          string uid = 3;
   131          string resource_version = 4;
   132          int64 generation = 5;
   133          // timestamp is in Epoch format, unit: seconds
   134          int64 creation_timestamp = 6;
   135          // optional deletion timestamp in Epoch format, unit: seconds
   136          int64 deletion_timestamp = 7;
   137          map<string, string> annotations = 8;
   138          map<string, string> labels = 9;
   139      }
   140  
   141      message Spec {
   142          Health health = 1;
   143  
   144          message Health {
   145              bool disabled = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {format: "boolean"}];
   146              int32 period_seconds = 2;
   147              int32 failure_threshold = 3;
   148              int32 initial_delay_seconds = 4;
   149          }
   150      }
   151  
   152      message Status {
   153          message Address {
   154              string type = 1;
   155              string address = 2;
   156          }
   157  
   158          message Port {
   159              string name = 1;
   160              int32 port = 2;
   161          }
   162          // [Stage:Alpha]
   163          // [FeatureFlag:PlayerTracking]
   164          message PlayerStatus {
   165              int64 count = 1;
   166              int64 capacity = 2;
   167              repeated string ids = 3;
   168          }
   169  
   170          // [Stage:Beta]
   171          // [FeatureFlag:CountsAndLists]
   172          message CounterStatus {
   173            int64 count = 1;
   174            int64 capacity = 2;
   175          }
   176  
   177          // [Stage:Beta]
   178          // [FeatureFlag:CountsAndLists]
   179          message ListStatus {
   180            int64 capacity = 1;
   181            repeated string values = 2;
   182          }
   183  
   184          string state = 1;
   185          string address = 2;
   186          repeated Address addresses = 7;
   187          repeated Port ports = 3;
   188  
   189          // [Stage:Alpha]
   190          // [FeatureFlag:PlayerTracking]
   191          PlayerStatus players = 4;
   192  
   193          // [Stage:Beta]
   194          // [FeatureFlag:CountsAndLists]
   195          map<string, CounterStatus> counters = 5;
   196  
   197          // [Stage:Beta]
   198          // [FeatureFlag:CountsAndLists]
   199          map<string, ListStatus> lists = 6;
   200      }
   201  }