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