forked from googleforgames/agones
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sdk.proto
151 lines (133 loc) · 3.92 KB
/
sdk.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// Copyright 2017 Google LLC All Rights Reserved.
//
// 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 stable.agones.dev.sdk;
option go_package = "sdk";
import "google/api/annotations.proto";
// SDK service to be used in the GameServer SDK to the Pod Sidecar
service SDK {
// Call when the GameServer is ready
rpc Ready (Empty) returns (Empty) {
option (google.api.http) = {
post: "/ready"
body: "*"
};
}
// Call to self Allocation the GameServer
rpc Allocate(Empty) returns (Empty) {
option (google.api.http) = {
post: "/allocate"
body: "*"
};
}
// Call when the GameServer is shutting down
rpc Shutdown (Empty) returns (Empty) {
option (google.api.http) = {
post: "/shutdown"
body: "*"
};
}
// Send a Empty every d Duration to declare that this GameSever is healthy
rpc Health (stream Empty) returns (Empty) {
option (google.api.http) = {
post: "/health"
body: "*"
};
}
// Retrieve the current GameServer data
rpc GetGameServer (Empty) returns (GameServer) {
option (google.api.http) = {
get: "/gameserver"
};
}
// Send GameServer details whenever the GameServer is updated
rpc WatchGameServer (Empty) returns (stream GameServer) {
option (google.api.http) = {
get: "/watch/gameserver"
};
}
// Apply a Label to the backing GameServer metadata
rpc SetLabel(KeyValue) returns (Empty) {
option (google.api.http) = {
put: "/metadata/label"
body: "*"
};
}
// Apply a Annotation to the backing GameServer metadata
rpc SetAnnotation(KeyValue) returns (Empty) {
option (google.api.http) = {
put: "/metadata/annotation"
body: "*"
};
}
// Marks the GameServer as the Reserved state for Duration
rpc Reserve(Duration) returns (Empty) {
option (google.api.http) = {
post: "/reserve"
body: "*"
};
}
}
// I am Empty
message Empty {
}
// Key, Value entry
message KeyValue {
string key = 1;
string value = 2;
}
// time duration, in seconds
message Duration {
int64 seconds = 1;
}
// A GameServer Custom Resource Definition object
// We will only export those resources that make the most
// sense. Can always expand to more as needed.
message GameServer {
ObjectMeta object_meta = 1;
Spec spec = 2;
Status status = 3;
// representation of the K8s ObjectMeta resource
message ObjectMeta {
string name = 1;
string namespace = 2;
string uid = 3;
string resource_version = 4;
int64 generation = 5;
// timestamp is in Epoch format, unit: seconds
int64 creation_timestamp = 6;
// optional deletion timestamp in Epoch format, unit: seconds
int64 deletion_timestamp = 7;
map<string, string> annotations = 8;
map<string, string> labels = 9;
}
message Spec {
Health health = 1;
message Health {
bool disabled = 1;
int32 period_seconds = 2;
int32 failure_threshold = 3;
int32 initial_delay_seconds = 4;
}
}
message Status {
message Port {
string name = 1;
int32 port = 2;
}
string state = 1;
string address = 2;
repeated Port ports = 3;
}
}