This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
/
GameServerConfigsServiceClient.java
865 lines (817 loc) · 33.9 KB
/
GameServerConfigsServiceClient.java
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
/*
* Copyright 2021 Google LLC
*
* 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
*
* https://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.
*/
package com.google.cloud.gaming.v1;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.gaming.v1.stub.GameServerConfigsServiceStub;
import com.google.cloud.gaming.v1.stub.GameServerConfigsServiceStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
import com.google.longrunning.OperationsClient;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: The game server config configures the game servers in an Agones fleet.
*
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* GameServerConfigName name =
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]");
* GameServerConfig response = gameServerConfigsServiceClient.getGameServerConfig(name);
* }
* }</pre>
*
* <p>Note: close() needs to be called on the GameServerConfigsServiceClient object to clean up
* resources such as threads. In the example above, try-with-resources is used, which automatically
* calls close().
*
* <p>The surface of this class includes several types of Java methods for each of the API's
* methods:
*
* <ol>
* <li>A "flattened" method. With this type of method, the fields of the request type have been
* converted into function parameters. It may be the case that not all fields are available as
* parameters, and not every API method will have a flattened method entry point.
* <li>A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
* <li>A "callable" method. This type of method takes no parameters and returns an immutable API
* callable object, which can be used to initiate calls to the service.
* </ol>
*
* <p>See the individual methods for example code.
*
* <p>Many parameters require resource names to be formatted in a particular way. To assist with
* these names, this class includes a format method for each type of name, and additionally a parse
* method to extract the individual identifiers contained within names that are returned.
*
* <p>This class can be customized by passing in a custom instance of
* GameServerConfigsServiceSettings to create(). For example:
*
* <p>To customize credentials:
*
* <pre>{@code
* GameServerConfigsServiceSettings gameServerConfigsServiceSettings =
* GameServerConfigsServiceSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create(gameServerConfigsServiceSettings);
* }</pre>
*
* <p>To customize the endpoint:
*
* <pre>{@code
* GameServerConfigsServiceSettings gameServerConfigsServiceSettings =
* GameServerConfigsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
* GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create(gameServerConfigsServiceSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class GameServerConfigsServiceClient implements BackgroundResource {
private final GameServerConfigsServiceSettings settings;
private final GameServerConfigsServiceStub stub;
private final OperationsClient operationsClient;
/** Constructs an instance of GameServerConfigsServiceClient with default settings. */
public static final GameServerConfigsServiceClient create() throws IOException {
return create(GameServerConfigsServiceSettings.newBuilder().build());
}
/**
* Constructs an instance of GameServerConfigsServiceClient, using the given settings. The
* channels are created based on the settings passed in, or defaults for any settings that are not
* set.
*/
public static final GameServerConfigsServiceClient create(
GameServerConfigsServiceSettings settings) throws IOException {
return new GameServerConfigsServiceClient(settings);
}
/**
* Constructs an instance of GameServerConfigsServiceClient, using the given stub for making
* calls. This is for advanced usage - prefer using create(GameServerConfigsServiceSettings).
*/
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final GameServerConfigsServiceClient create(GameServerConfigsServiceStub stub) {
return new GameServerConfigsServiceClient(stub);
}
/**
* Constructs an instance of GameServerConfigsServiceClient, using the given settings. This is
* protected so that it is easy to make a subclass, but otherwise, the static factory methods
* should be preferred.
*/
protected GameServerConfigsServiceClient(GameServerConfigsServiceSettings settings)
throws IOException {
this.settings = settings;
this.stub = ((GameServerConfigsServiceStubSettings) settings.getStubSettings()).createStub();
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected GameServerConfigsServiceClient(GameServerConfigsServiceStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}
public final GameServerConfigsServiceSettings getSettings() {
return settings;
}
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public GameServerConfigsServiceStub getStub() {
return stub;
}
/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
public final OperationsClient getOperationsClient() {
return operationsClient;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists game server configs in a given project, location, and game server deployment.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* GameServerDeploymentName parent =
* GameServerDeploymentName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]");
* for (GameServerConfig element :
* gameServerConfigsServiceClient.listGameServerConfigs(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param parent Required. The parent resource name. Uses the form:
* <p>`projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/*`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListGameServerConfigsPagedResponse listGameServerConfigs(
GameServerDeploymentName parent) {
ListGameServerConfigsRequest request =
ListGameServerConfigsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listGameServerConfigs(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists game server configs in a given project, location, and game server deployment.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* String parent =
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]").toString();
* for (GameServerConfig element :
* gameServerConfigsServiceClient.listGameServerConfigs(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param parent Required. The parent resource name. Uses the form:
* <p>`projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/*`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListGameServerConfigsPagedResponse listGameServerConfigs(String parent) {
ListGameServerConfigsRequest request =
ListGameServerConfigsRequest.newBuilder().setParent(parent).build();
return listGameServerConfigs(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists game server configs in a given project, location, and game server deployment.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* ListGameServerConfigsRequest request =
* ListGameServerConfigsRequest.newBuilder()
* .setParent(
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]")
* .toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .setOrderBy("orderBy-1207110587")
* .build();
* for (GameServerConfig element :
* gameServerConfigsServiceClient.listGameServerConfigs(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListGameServerConfigsPagedResponse listGameServerConfigs(
ListGameServerConfigsRequest request) {
return listGameServerConfigsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists game server configs in a given project, location, and game server deployment.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* ListGameServerConfigsRequest request =
* ListGameServerConfigsRequest.newBuilder()
* .setParent(
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]")
* .toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .setOrderBy("orderBy-1207110587")
* .build();
* ApiFuture<GameServerConfig> future =
* gameServerConfigsServiceClient.listGameServerConfigsPagedCallable().futureCall(request);
* // Do something.
* for (GameServerConfig element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*/
public final UnaryCallable<ListGameServerConfigsRequest, ListGameServerConfigsPagedResponse>
listGameServerConfigsPagedCallable() {
return stub.listGameServerConfigsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists game server configs in a given project, location, and game server deployment.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* ListGameServerConfigsRequest request =
* ListGameServerConfigsRequest.newBuilder()
* .setParent(
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]")
* .toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .setOrderBy("orderBy-1207110587")
* .build();
* while (true) {
* ListGameServerConfigsResponse response =
* gameServerConfigsServiceClient.listGameServerConfigsCallable().call(request);
* for (GameServerConfig element : response.getResponsesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }</pre>
*/
public final UnaryCallable<ListGameServerConfigsRequest, ListGameServerConfigsResponse>
listGameServerConfigsCallable() {
return stub.listGameServerConfigsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single game server config.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* GameServerConfigName name =
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]");
* GameServerConfig response = gameServerConfigsServiceClient.getGameServerConfig(name);
* }
* }</pre>
*
* @param name Required. The name of the game server config to retrieve. Uses the form:
* <p>`projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GameServerConfig getGameServerConfig(GameServerConfigName name) {
GetGameServerConfigRequest request =
GetGameServerConfigRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return getGameServerConfig(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single game server config.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* String name =
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]").toString();
* GameServerConfig response = gameServerConfigsServiceClient.getGameServerConfig(name);
* }
* }</pre>
*
* @param name Required. The name of the game server config to retrieve. Uses the form:
* <p>`projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GameServerConfig getGameServerConfig(String name) {
GetGameServerConfigRequest request =
GetGameServerConfigRequest.newBuilder().setName(name).build();
return getGameServerConfig(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single game server config.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* GetGameServerConfigRequest request =
* GetGameServerConfigRequest.newBuilder()
* .setName(
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]")
* .toString())
* .build();
* GameServerConfig response = gameServerConfigsServiceClient.getGameServerConfig(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GameServerConfig getGameServerConfig(GetGameServerConfigRequest request) {
return getGameServerConfigCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single game server config.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* GetGameServerConfigRequest request =
* GetGameServerConfigRequest.newBuilder()
* .setName(
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]")
* .toString())
* .build();
* ApiFuture<GameServerConfig> future =
* gameServerConfigsServiceClient.getGameServerConfigCallable().futureCall(request);
* // Do something.
* GameServerConfig response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<GetGameServerConfigRequest, GameServerConfig>
getGameServerConfigCallable() {
return stub.getGameServerConfigCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new game server config in a given project, location, and game server deployment. Game
* server configs are immutable, and are not applied until referenced in the game server
* deployment rollout resource.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* GameServerDeploymentName parent =
* GameServerDeploymentName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]");
* GameServerConfig gameServerConfig = GameServerConfig.newBuilder().build();
* GameServerConfig response =
* gameServerConfigsServiceClient
* .createGameServerConfigAsync(parent, gameServerConfig)
* .get();
* }
* }</pre>
*
* @param parent Required. The parent resource name. Uses the form:
* <p>`projects/{project}/locations/{location}/gameServerDeployments/{deployment}/`.
* @param gameServerConfig Required. The game server config resource to be created.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<GameServerConfig, OperationMetadata> createGameServerConfigAsync(
GameServerDeploymentName parent, GameServerConfig gameServerConfig) {
CreateGameServerConfigRequest request =
CreateGameServerConfigRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setGameServerConfig(gameServerConfig)
.build();
return createGameServerConfigAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new game server config in a given project, location, and game server deployment. Game
* server configs are immutable, and are not applied until referenced in the game server
* deployment rollout resource.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* String parent =
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]").toString();
* GameServerConfig gameServerConfig = GameServerConfig.newBuilder().build();
* GameServerConfig response =
* gameServerConfigsServiceClient
* .createGameServerConfigAsync(parent, gameServerConfig)
* .get();
* }
* }</pre>
*
* @param parent Required. The parent resource name. Uses the form:
* <p>`projects/{project}/locations/{location}/gameServerDeployments/{deployment}/`.
* @param gameServerConfig Required. The game server config resource to be created.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<GameServerConfig, OperationMetadata> createGameServerConfigAsync(
String parent, GameServerConfig gameServerConfig) {
CreateGameServerConfigRequest request =
CreateGameServerConfigRequest.newBuilder()
.setParent(parent)
.setGameServerConfig(gameServerConfig)
.build();
return createGameServerConfigAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new game server config in a given project, location, and game server deployment. Game
* server configs are immutable, and are not applied until referenced in the game server
* deployment rollout resource.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* CreateGameServerConfigRequest request =
* CreateGameServerConfigRequest.newBuilder()
* .setParent(
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]")
* .toString())
* .setConfigId("configId-580140035")
* .setGameServerConfig(GameServerConfig.newBuilder().build())
* .build();
* GameServerConfig response =
* gameServerConfigsServiceClient.createGameServerConfigAsync(request).get();
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<GameServerConfig, OperationMetadata> createGameServerConfigAsync(
CreateGameServerConfigRequest request) {
return createGameServerConfigOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new game server config in a given project, location, and game server deployment. Game
* server configs are immutable, and are not applied until referenced in the game server
* deployment rollout resource.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* CreateGameServerConfigRequest request =
* CreateGameServerConfigRequest.newBuilder()
* .setParent(
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]")
* .toString())
* .setConfigId("configId-580140035")
* .setGameServerConfig(GameServerConfig.newBuilder().build())
* .build();
* OperationFuture<GameServerConfig, OperationMetadata> future =
* gameServerConfigsServiceClient
* .createGameServerConfigOperationCallable()
* .futureCall(request);
* // Do something.
* GameServerConfig response = future.get();
* }
* }</pre>
*/
public final OperationCallable<CreateGameServerConfigRequest, GameServerConfig, OperationMetadata>
createGameServerConfigOperationCallable() {
return stub.createGameServerConfigOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new game server config in a given project, location, and game server deployment. Game
* server configs are immutable, and are not applied until referenced in the game server
* deployment rollout resource.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* CreateGameServerConfigRequest request =
* CreateGameServerConfigRequest.newBuilder()
* .setParent(
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]")
* .toString())
* .setConfigId("configId-580140035")
* .setGameServerConfig(GameServerConfig.newBuilder().build())
* .build();
* ApiFuture<Operation> future =
* gameServerConfigsServiceClient.createGameServerConfigCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<CreateGameServerConfigRequest, Operation>
createGameServerConfigCallable() {
return stub.createGameServerConfigCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single game server config. The deletion will fail if the game server config is
* referenced in a game server deployment rollout.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* GameServerConfigName name =
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]");
* gameServerConfigsServiceClient.deleteGameServerConfigAsync(name).get();
* }
* }</pre>
*
* @param name Required. The name of the game server config to delete. Uses the form:
* <p>`projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Empty, OperationMetadata> deleteGameServerConfigAsync(
GameServerConfigName name) {
DeleteGameServerConfigRequest request =
DeleteGameServerConfigRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return deleteGameServerConfigAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single game server config. The deletion will fail if the game server config is
* referenced in a game server deployment rollout.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* String name =
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]").toString();
* gameServerConfigsServiceClient.deleteGameServerConfigAsync(name).get();
* }
* }</pre>
*
* @param name Required. The name of the game server config to delete. Uses the form:
* <p>`projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Empty, OperationMetadata> deleteGameServerConfigAsync(String name) {
DeleteGameServerConfigRequest request =
DeleteGameServerConfigRequest.newBuilder().setName(name).build();
return deleteGameServerConfigAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single game server config. The deletion will fail if the game server config is
* referenced in a game server deployment rollout.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* DeleteGameServerConfigRequest request =
* DeleteGameServerConfigRequest.newBuilder()
* .setName(
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]")
* .toString())
* .build();
* gameServerConfigsServiceClient.deleteGameServerConfigAsync(request).get();
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Empty, OperationMetadata> deleteGameServerConfigAsync(
DeleteGameServerConfigRequest request) {
return deleteGameServerConfigOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single game server config. The deletion will fail if the game server config is
* referenced in a game server deployment rollout.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* DeleteGameServerConfigRequest request =
* DeleteGameServerConfigRequest.newBuilder()
* .setName(
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]")
* .toString())
* .build();
* OperationFuture<Empty, OperationMetadata> future =
* gameServerConfigsServiceClient
* .deleteGameServerConfigOperationCallable()
* .futureCall(request);
* // Do something.
* future.get();
* }
* }</pre>
*/
public final OperationCallable<DeleteGameServerConfigRequest, Empty, OperationMetadata>
deleteGameServerConfigOperationCallable() {
return stub.deleteGameServerConfigOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single game server config. The deletion will fail if the game server config is
* referenced in a game server deployment rollout.
*
* <p>Sample code:
*
* <pre>{@code
* try (GameServerConfigsServiceClient gameServerConfigsServiceClient =
* GameServerConfigsServiceClient.create()) {
* DeleteGameServerConfigRequest request =
* DeleteGameServerConfigRequest.newBuilder()
* .setName(
* GameServerConfigName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]")
* .toString())
* .build();
* ApiFuture<Operation> future =
* gameServerConfigsServiceClient.deleteGameServerConfigCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }</pre>
*/
public final UnaryCallable<DeleteGameServerConfigRequest, Operation>
deleteGameServerConfigCallable() {
return stub.deleteGameServerConfigCallable();
}
@Override
public final void close() {
stub.close();
}
@Override
public void shutdown() {
stub.shutdown();
}
@Override
public boolean isShutdown() {
return stub.isShutdown();
}
@Override
public boolean isTerminated() {
return stub.isTerminated();
}
@Override
public void shutdownNow() {
stub.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return stub.awaitTermination(duration, unit);
}
public static class ListGameServerConfigsPagedResponse
extends AbstractPagedListResponse<
ListGameServerConfigsRequest,
ListGameServerConfigsResponse,
GameServerConfig,
ListGameServerConfigsPage,
ListGameServerConfigsFixedSizeCollection> {
public static ApiFuture<ListGameServerConfigsPagedResponse> createAsync(
PageContext<ListGameServerConfigsRequest, ListGameServerConfigsResponse, GameServerConfig>
context,
ApiFuture<ListGameServerConfigsResponse> futureResponse) {
ApiFuture<ListGameServerConfigsPage> futurePage =
ListGameServerConfigsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListGameServerConfigsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListGameServerConfigsPagedResponse(ListGameServerConfigsPage page) {
super(page, ListGameServerConfigsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListGameServerConfigsPage
extends AbstractPage<
ListGameServerConfigsRequest,
ListGameServerConfigsResponse,
GameServerConfig,
ListGameServerConfigsPage> {
private ListGameServerConfigsPage(
PageContext<ListGameServerConfigsRequest, ListGameServerConfigsResponse, GameServerConfig>
context,
ListGameServerConfigsResponse response) {
super(context, response);
}
private static ListGameServerConfigsPage createEmptyPage() {
return new ListGameServerConfigsPage(null, null);
}
@Override
protected ListGameServerConfigsPage createPage(
PageContext<ListGameServerConfigsRequest, ListGameServerConfigsResponse, GameServerConfig>
context,
ListGameServerConfigsResponse response) {
return new ListGameServerConfigsPage(context, response);
}
@Override
public ApiFuture<ListGameServerConfigsPage> createPageAsync(
PageContext<ListGameServerConfigsRequest, ListGameServerConfigsResponse, GameServerConfig>
context,
ApiFuture<ListGameServerConfigsResponse> futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListGameServerConfigsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListGameServerConfigsRequest,
ListGameServerConfigsResponse,
GameServerConfig,
ListGameServerConfigsPage,
ListGameServerConfigsFixedSizeCollection> {
private ListGameServerConfigsFixedSizeCollection(
List<ListGameServerConfigsPage> pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListGameServerConfigsFixedSizeCollection createEmptyCollection() {
return new ListGameServerConfigsFixedSizeCollection(null, 0);
}
@Override
protected ListGameServerConfigsFixedSizeCollection createCollection(
List<ListGameServerConfigsPage> pages, int collectionSize) {
return new ListGameServerConfigsFixedSizeCollection(pages, collectionSize);
}
}
}