1// Copyright 2021 Google LLC
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
15syntax = "proto3";
16
17package google.cloud.gaming.v1;
18
19import "google/api/field_behavior.proto";
20import "google/protobuf/duration.proto";
21import "google/protobuf/timestamp.proto";
22
23option go_package = "cloud.google.com/go/gaming/apiv1/gamingpb;gamingpb";
24option java_multiple_files = true;
25option java_package = "com.google.cloud.gaming.v1";
26
27// Represents the metadata of the long-running operation.
28message OperationMetadata {
29  // Output only. The time the operation was created.
30  google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
31
32  // Output only. The time the operation finished running.
33  google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
34
35  // Output only. Server-defined resource path for the target of the operation.
36  string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
37
38  // Output only. Name of the verb executed by the operation.
39  string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
40
41  // Output only. Human-readable status of the operation, if any.
42  string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
43
44  // Output only. Identifies whether the user has requested cancellation
45  // of the operation. Operations that have successfully been cancelled
46  // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
47  // corresponding to `Code.CANCELLED`.
48  bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
49
50  // Output only. API version used to start the operation.
51  string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
52
53  // Output only. List of Locations that could not be reached.
54  repeated string unreachable = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
55
56  // Output only. Operation status for Game Services API operations. Operation status is in
57  // the form of key-value pairs where keys are resource IDs and the values show
58  // the status of the operation. In case of failures, the value includes an
59  // error code and error message.
60  map<string, OperationStatus> operation_status = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
61}
62
63message OperationStatus {
64  enum ErrorCode {
65    ERROR_CODE_UNSPECIFIED = 0;
66
67    INTERNAL_ERROR = 1;
68
69    PERMISSION_DENIED = 2;
70
71    CLUSTER_CONNECTION = 3;
72  }
73
74  // Output only. Whether the operation is done or still in progress.
75  bool done = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
76
77  // The error code in case of failures.
78  ErrorCode error_code = 2;
79
80  // The human-readable error message.
81  string error_message = 3;
82}
83
84// The label selector, used to group labels on the resources.
85message LabelSelector {
86  // Resource labels for this selector.
87  map<string, string> labels = 1;
88}
89
90// The realm selector, used to match realm resources.
91message RealmSelector {
92  // List of realms to match.
93  repeated string realms = 1;
94}
95
96// The schedule of a recurring or one time event. The event's time span is
97// specified by start_time and end_time. If the scheduled event's timespan is
98// larger than the cron_spec + cron_job_duration, the event will be recurring.
99// If only cron_spec + cron_job_duration are specified, the event is effective
100// starting at the local time specified by cron_spec, and is recurring.
101//
102// ```
103// start_time|-------[cron job]-------[cron job]-------[cron job]---|end_time
104// cron job: cron spec start time + duration
105// ```
106message Schedule {
107  // The start time of the event.
108  google.protobuf.Timestamp start_time = 1;
109
110  // The end time of the event.
111  google.protobuf.Timestamp end_time = 2;
112
113  // The duration for the cron job event. The duration of the event is effective
114  // after the cron job's start time.
115  google.protobuf.Duration cron_job_duration = 3;
116
117  // The cron definition of the scheduled event. See
118  // https://en.wikipedia.org/wiki/Cron. Cron spec specifies the local time as
119  // defined by the realm.
120  string cron_spec = 4;
121}
122
123// Encapsulates Agones fleet spec and Agones autoscaler spec sources.
124message SpecSource {
125  // The game server config resource. Uses the form:
126  // `projects/{project}/locations/{location}/gameServerDeployments/{deployment_id}/configs/{config_id}`.
127  string game_server_config_name = 1;
128
129  // The name of the Agones leet config or Agones scaling config used to derive
130  // the Agones fleet or Agones autoscaler spec.
131  string name = 2;
132}
133
134// Details about the Agones resources.
135message TargetDetails {
136  // Details of the target Agones fleet.
137  message TargetFleetDetails {
138    // Target Agones fleet specification.
139    message TargetFleet {
140      // The name of the Agones fleet.
141      string name = 1;
142
143      // Encapsulates the source of the Agones fleet spec.
144      // The Agones fleet spec source.
145      SpecSource spec_source = 2;
146    }
147
148    // Target Agones autoscaler policy reference.
149    message TargetFleetAutoscaler {
150      // The name of the Agones autoscaler.
151      string name = 1;
152
153      // Encapsulates the source of the Agones fleet spec.
154      // Details about the Agones autoscaler spec.
155      SpecSource spec_source = 2;
156    }
157
158    // Reference to target Agones fleet.
159    TargetFleet fleet = 1;
160
161    // Reference to target Agones fleet autoscaling policy.
162    TargetFleetAutoscaler autoscaler = 2;
163  }
164
165  // The game server cluster name. Uses the form:
166  // `projects/{project}/locations/{location}/realms/{realm}/gameServerClusters/{cluster}`.
167  string game_server_cluster_name = 1;
168
169  // The game server deployment name. Uses the form:
170  // `projects/{project}/locations/{location}/gameServerDeployments/{deployment_id}`.
171  string game_server_deployment_name = 2;
172
173  // Agones fleet details for game server clusters and game server deployments.
174  repeated TargetFleetDetails fleet_details = 3;
175}
176
177// Encapsulates the Target state.
178message TargetState {
179  // Details about Agones fleets.
180  repeated TargetDetails details = 1;
181}
182
183// Details of the deployed Agones fleet.
184message DeployedFleetDetails {
185  // Agones fleet specification and details.
186  message DeployedFleet {
187    // DeployedFleetStatus has details about the Agones fleets such as how many
188    // are running, how many allocated, and so on.
189    message DeployedFleetStatus {
190      // The number of GameServer replicas in the READY state in this fleet.
191      int64 ready_replicas = 1;
192
193      // The number of GameServer replicas in the ALLOCATED state in this fleet.
194      int64 allocated_replicas = 2;
195
196      // The number of GameServer replicas in the RESERVED state in this fleet.
197      // Reserved instances won't be deleted on scale down, but won't cause
198      // an autoscaler to scale up.
199      int64 reserved_replicas = 3;
200
201      // The total number of current GameServer replicas in this fleet.
202      int64 replicas = 4;
203    }
204
205    // The name of the Agones fleet.
206    string fleet = 1;
207
208    // The fleet spec retrieved from the Agones fleet.
209    string fleet_spec = 2;
210
211    // The source spec that is used to create the Agones fleet.
212    // The GameServerConfig resource may no longer exist in the system.
213    SpecSource spec_source = 3;
214
215    // The current status of the Agones fleet.
216    // Includes count of game servers in various states.
217    DeployedFleetStatus status = 5;
218  }
219
220  // Details about the Agones autoscaler.
221  message DeployedFleetAutoscaler {
222    // The name of the Agones autoscaler.
223    string autoscaler = 1;
224
225    // The source spec that is used to create the autoscaler.
226    // The GameServerConfig resource may no longer exist in the system.
227    SpecSource spec_source = 4;
228
229    // The autoscaler spec retrieved from Agones.
230    string fleet_autoscaler_spec = 3;
231  }
232
233  // Information about the Agones fleet.
234  DeployedFleet deployed_fleet = 1;
235
236  // Information about the Agones autoscaler for that fleet.
237  DeployedFleetAutoscaler deployed_autoscaler = 2;
238}
239