• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.cloud.container.v1.stub;
18 
19 import static com.google.cloud.container.v1.ClusterManagerClient.ListUsableSubnetworksPagedResponse;
20 
21 import com.google.api.gax.core.BackgroundResource;
22 import com.google.api.gax.core.BackgroundResourceAggregation;
23 import com.google.api.gax.grpc.GrpcCallSettings;
24 import com.google.api.gax.grpc.GrpcStubCallableFactory;
25 import com.google.api.gax.rpc.ClientContext;
26 import com.google.api.gax.rpc.UnaryCallable;
27 import com.google.common.collect.ImmutableMap;
28 import com.google.container.v1.CancelOperationRequest;
29 import com.google.container.v1.Cluster;
30 import com.google.container.v1.CompleteIPRotationRequest;
31 import com.google.container.v1.CompleteNodePoolUpgradeRequest;
32 import com.google.container.v1.CreateClusterRequest;
33 import com.google.container.v1.CreateNodePoolRequest;
34 import com.google.container.v1.DeleteClusterRequest;
35 import com.google.container.v1.DeleteNodePoolRequest;
36 import com.google.container.v1.GetClusterRequest;
37 import com.google.container.v1.GetJSONWebKeysRequest;
38 import com.google.container.v1.GetJSONWebKeysResponse;
39 import com.google.container.v1.GetNodePoolRequest;
40 import com.google.container.v1.GetOperationRequest;
41 import com.google.container.v1.GetServerConfigRequest;
42 import com.google.container.v1.ListClustersRequest;
43 import com.google.container.v1.ListClustersResponse;
44 import com.google.container.v1.ListNodePoolsRequest;
45 import com.google.container.v1.ListNodePoolsResponse;
46 import com.google.container.v1.ListOperationsRequest;
47 import com.google.container.v1.ListOperationsResponse;
48 import com.google.container.v1.ListUsableSubnetworksRequest;
49 import com.google.container.v1.ListUsableSubnetworksResponse;
50 import com.google.container.v1.NodePool;
51 import com.google.container.v1.Operation;
52 import com.google.container.v1.RollbackNodePoolUpgradeRequest;
53 import com.google.container.v1.ServerConfig;
54 import com.google.container.v1.SetAddonsConfigRequest;
55 import com.google.container.v1.SetLabelsRequest;
56 import com.google.container.v1.SetLegacyAbacRequest;
57 import com.google.container.v1.SetLocationsRequest;
58 import com.google.container.v1.SetLoggingServiceRequest;
59 import com.google.container.v1.SetMaintenancePolicyRequest;
60 import com.google.container.v1.SetMasterAuthRequest;
61 import com.google.container.v1.SetMonitoringServiceRequest;
62 import com.google.container.v1.SetNetworkPolicyRequest;
63 import com.google.container.v1.SetNodePoolAutoscalingRequest;
64 import com.google.container.v1.SetNodePoolManagementRequest;
65 import com.google.container.v1.SetNodePoolSizeRequest;
66 import com.google.container.v1.StartIPRotationRequest;
67 import com.google.container.v1.UpdateClusterRequest;
68 import com.google.container.v1.UpdateMasterRequest;
69 import com.google.container.v1.UpdateNodePoolRequest;
70 import com.google.longrunning.stub.GrpcOperationsStub;
71 import com.google.protobuf.Empty;
72 import io.grpc.MethodDescriptor;
73 import io.grpc.protobuf.ProtoUtils;
74 import java.io.IOException;
75 import java.util.concurrent.TimeUnit;
76 import javax.annotation.Generated;
77 
78 // AUTO-GENERATED DOCUMENTATION AND CLASS.
79 /**
80  * gRPC stub implementation for the ClusterManager service API.
81  *
82  * <p>This class is for advanced usage and reflects the underlying API directly.
83  */
84 @Generated("by gapic-generator-java")
85 public class GrpcClusterManagerStub extends ClusterManagerStub {
86   private static final MethodDescriptor<ListClustersRequest, ListClustersResponse>
87       listClustersMethodDescriptor =
88           MethodDescriptor.<ListClustersRequest, ListClustersResponse>newBuilder()
89               .setType(MethodDescriptor.MethodType.UNARY)
90               .setFullMethodName("google.container.v1.ClusterManager/ListClusters")
91               .setRequestMarshaller(ProtoUtils.marshaller(ListClustersRequest.getDefaultInstance()))
92               .setResponseMarshaller(
93                   ProtoUtils.marshaller(ListClustersResponse.getDefaultInstance()))
94               .build();
95 
96   private static final MethodDescriptor<GetClusterRequest, Cluster> getClusterMethodDescriptor =
97       MethodDescriptor.<GetClusterRequest, Cluster>newBuilder()
98           .setType(MethodDescriptor.MethodType.UNARY)
99           .setFullMethodName("google.container.v1.ClusterManager/GetCluster")
100           .setRequestMarshaller(ProtoUtils.marshaller(GetClusterRequest.getDefaultInstance()))
101           .setResponseMarshaller(ProtoUtils.marshaller(Cluster.getDefaultInstance()))
102           .build();
103 
104   private static final MethodDescriptor<CreateClusterRequest, Operation>
105       createClusterMethodDescriptor =
106           MethodDescriptor.<CreateClusterRequest, Operation>newBuilder()
107               .setType(MethodDescriptor.MethodType.UNARY)
108               .setFullMethodName("google.container.v1.ClusterManager/CreateCluster")
109               .setRequestMarshaller(
110                   ProtoUtils.marshaller(CreateClusterRequest.getDefaultInstance()))
111               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
112               .build();
113 
114   private static final MethodDescriptor<UpdateClusterRequest, Operation>
115       updateClusterMethodDescriptor =
116           MethodDescriptor.<UpdateClusterRequest, Operation>newBuilder()
117               .setType(MethodDescriptor.MethodType.UNARY)
118               .setFullMethodName("google.container.v1.ClusterManager/UpdateCluster")
119               .setRequestMarshaller(
120                   ProtoUtils.marshaller(UpdateClusterRequest.getDefaultInstance()))
121               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
122               .build();
123 
124   private static final MethodDescriptor<UpdateNodePoolRequest, Operation>
125       updateNodePoolMethodDescriptor =
126           MethodDescriptor.<UpdateNodePoolRequest, Operation>newBuilder()
127               .setType(MethodDescriptor.MethodType.UNARY)
128               .setFullMethodName("google.container.v1.ClusterManager/UpdateNodePool")
129               .setRequestMarshaller(
130                   ProtoUtils.marshaller(UpdateNodePoolRequest.getDefaultInstance()))
131               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
132               .build();
133 
134   private static final MethodDescriptor<SetNodePoolAutoscalingRequest, Operation>
135       setNodePoolAutoscalingMethodDescriptor =
136           MethodDescriptor.<SetNodePoolAutoscalingRequest, Operation>newBuilder()
137               .setType(MethodDescriptor.MethodType.UNARY)
138               .setFullMethodName("google.container.v1.ClusterManager/SetNodePoolAutoscaling")
139               .setRequestMarshaller(
140                   ProtoUtils.marshaller(SetNodePoolAutoscalingRequest.getDefaultInstance()))
141               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
142               .build();
143 
144   private static final MethodDescriptor<SetLoggingServiceRequest, Operation>
145       setLoggingServiceMethodDescriptor =
146           MethodDescriptor.<SetLoggingServiceRequest, Operation>newBuilder()
147               .setType(MethodDescriptor.MethodType.UNARY)
148               .setFullMethodName("google.container.v1.ClusterManager/SetLoggingService")
149               .setRequestMarshaller(
150                   ProtoUtils.marshaller(SetLoggingServiceRequest.getDefaultInstance()))
151               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
152               .build();
153 
154   private static final MethodDescriptor<SetMonitoringServiceRequest, Operation>
155       setMonitoringServiceMethodDescriptor =
156           MethodDescriptor.<SetMonitoringServiceRequest, Operation>newBuilder()
157               .setType(MethodDescriptor.MethodType.UNARY)
158               .setFullMethodName("google.container.v1.ClusterManager/SetMonitoringService")
159               .setRequestMarshaller(
160                   ProtoUtils.marshaller(SetMonitoringServiceRequest.getDefaultInstance()))
161               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
162               .build();
163 
164   private static final MethodDescriptor<SetAddonsConfigRequest, Operation>
165       setAddonsConfigMethodDescriptor =
166           MethodDescriptor.<SetAddonsConfigRequest, Operation>newBuilder()
167               .setType(MethodDescriptor.MethodType.UNARY)
168               .setFullMethodName("google.container.v1.ClusterManager/SetAddonsConfig")
169               .setRequestMarshaller(
170                   ProtoUtils.marshaller(SetAddonsConfigRequest.getDefaultInstance()))
171               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
172               .build();
173 
174   private static final MethodDescriptor<SetLocationsRequest, Operation>
175       setLocationsMethodDescriptor =
176           MethodDescriptor.<SetLocationsRequest, Operation>newBuilder()
177               .setType(MethodDescriptor.MethodType.UNARY)
178               .setFullMethodName("google.container.v1.ClusterManager/SetLocations")
179               .setRequestMarshaller(ProtoUtils.marshaller(SetLocationsRequest.getDefaultInstance()))
180               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
181               .build();
182 
183   private static final MethodDescriptor<UpdateMasterRequest, Operation>
184       updateMasterMethodDescriptor =
185           MethodDescriptor.<UpdateMasterRequest, Operation>newBuilder()
186               .setType(MethodDescriptor.MethodType.UNARY)
187               .setFullMethodName("google.container.v1.ClusterManager/UpdateMaster")
188               .setRequestMarshaller(ProtoUtils.marshaller(UpdateMasterRequest.getDefaultInstance()))
189               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
190               .build();
191 
192   private static final MethodDescriptor<SetMasterAuthRequest, Operation>
193       setMasterAuthMethodDescriptor =
194           MethodDescriptor.<SetMasterAuthRequest, Operation>newBuilder()
195               .setType(MethodDescriptor.MethodType.UNARY)
196               .setFullMethodName("google.container.v1.ClusterManager/SetMasterAuth")
197               .setRequestMarshaller(
198                   ProtoUtils.marshaller(SetMasterAuthRequest.getDefaultInstance()))
199               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
200               .build();
201 
202   private static final MethodDescriptor<DeleteClusterRequest, Operation>
203       deleteClusterMethodDescriptor =
204           MethodDescriptor.<DeleteClusterRequest, Operation>newBuilder()
205               .setType(MethodDescriptor.MethodType.UNARY)
206               .setFullMethodName("google.container.v1.ClusterManager/DeleteCluster")
207               .setRequestMarshaller(
208                   ProtoUtils.marshaller(DeleteClusterRequest.getDefaultInstance()))
209               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
210               .build();
211 
212   private static final MethodDescriptor<ListOperationsRequest, ListOperationsResponse>
213       listOperationsMethodDescriptor =
214           MethodDescriptor.<ListOperationsRequest, ListOperationsResponse>newBuilder()
215               .setType(MethodDescriptor.MethodType.UNARY)
216               .setFullMethodName("google.container.v1.ClusterManager/ListOperations")
217               .setRequestMarshaller(
218                   ProtoUtils.marshaller(ListOperationsRequest.getDefaultInstance()))
219               .setResponseMarshaller(
220                   ProtoUtils.marshaller(ListOperationsResponse.getDefaultInstance()))
221               .build();
222 
223   private static final MethodDescriptor<GetOperationRequest, Operation>
224       getOperationMethodDescriptor =
225           MethodDescriptor.<GetOperationRequest, Operation>newBuilder()
226               .setType(MethodDescriptor.MethodType.UNARY)
227               .setFullMethodName("google.container.v1.ClusterManager/GetOperation")
228               .setRequestMarshaller(ProtoUtils.marshaller(GetOperationRequest.getDefaultInstance()))
229               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
230               .build();
231 
232   private static final MethodDescriptor<CancelOperationRequest, Empty>
233       cancelOperationMethodDescriptor =
234           MethodDescriptor.<CancelOperationRequest, Empty>newBuilder()
235               .setType(MethodDescriptor.MethodType.UNARY)
236               .setFullMethodName("google.container.v1.ClusterManager/CancelOperation")
237               .setRequestMarshaller(
238                   ProtoUtils.marshaller(CancelOperationRequest.getDefaultInstance()))
239               .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
240               .build();
241 
242   private static final MethodDescriptor<GetServerConfigRequest, ServerConfig>
243       getServerConfigMethodDescriptor =
244           MethodDescriptor.<GetServerConfigRequest, ServerConfig>newBuilder()
245               .setType(MethodDescriptor.MethodType.UNARY)
246               .setFullMethodName("google.container.v1.ClusterManager/GetServerConfig")
247               .setRequestMarshaller(
248                   ProtoUtils.marshaller(GetServerConfigRequest.getDefaultInstance()))
249               .setResponseMarshaller(ProtoUtils.marshaller(ServerConfig.getDefaultInstance()))
250               .build();
251 
252   private static final MethodDescriptor<GetJSONWebKeysRequest, GetJSONWebKeysResponse>
253       getJSONWebKeysMethodDescriptor =
254           MethodDescriptor.<GetJSONWebKeysRequest, GetJSONWebKeysResponse>newBuilder()
255               .setType(MethodDescriptor.MethodType.UNARY)
256               .setFullMethodName("google.container.v1.ClusterManager/GetJSONWebKeys")
257               .setRequestMarshaller(
258                   ProtoUtils.marshaller(GetJSONWebKeysRequest.getDefaultInstance()))
259               .setResponseMarshaller(
260                   ProtoUtils.marshaller(GetJSONWebKeysResponse.getDefaultInstance()))
261               .build();
262 
263   private static final MethodDescriptor<ListNodePoolsRequest, ListNodePoolsResponse>
264       listNodePoolsMethodDescriptor =
265           MethodDescriptor.<ListNodePoolsRequest, ListNodePoolsResponse>newBuilder()
266               .setType(MethodDescriptor.MethodType.UNARY)
267               .setFullMethodName("google.container.v1.ClusterManager/ListNodePools")
268               .setRequestMarshaller(
269                   ProtoUtils.marshaller(ListNodePoolsRequest.getDefaultInstance()))
270               .setResponseMarshaller(
271                   ProtoUtils.marshaller(ListNodePoolsResponse.getDefaultInstance()))
272               .build();
273 
274   private static final MethodDescriptor<GetNodePoolRequest, NodePool> getNodePoolMethodDescriptor =
275       MethodDescriptor.<GetNodePoolRequest, NodePool>newBuilder()
276           .setType(MethodDescriptor.MethodType.UNARY)
277           .setFullMethodName("google.container.v1.ClusterManager/GetNodePool")
278           .setRequestMarshaller(ProtoUtils.marshaller(GetNodePoolRequest.getDefaultInstance()))
279           .setResponseMarshaller(ProtoUtils.marshaller(NodePool.getDefaultInstance()))
280           .build();
281 
282   private static final MethodDescriptor<CreateNodePoolRequest, Operation>
283       createNodePoolMethodDescriptor =
284           MethodDescriptor.<CreateNodePoolRequest, Operation>newBuilder()
285               .setType(MethodDescriptor.MethodType.UNARY)
286               .setFullMethodName("google.container.v1.ClusterManager/CreateNodePool")
287               .setRequestMarshaller(
288                   ProtoUtils.marshaller(CreateNodePoolRequest.getDefaultInstance()))
289               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
290               .build();
291 
292   private static final MethodDescriptor<DeleteNodePoolRequest, Operation>
293       deleteNodePoolMethodDescriptor =
294           MethodDescriptor.<DeleteNodePoolRequest, Operation>newBuilder()
295               .setType(MethodDescriptor.MethodType.UNARY)
296               .setFullMethodName("google.container.v1.ClusterManager/DeleteNodePool")
297               .setRequestMarshaller(
298                   ProtoUtils.marshaller(DeleteNodePoolRequest.getDefaultInstance()))
299               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
300               .build();
301 
302   private static final MethodDescriptor<CompleteNodePoolUpgradeRequest, Empty>
303       completeNodePoolUpgradeMethodDescriptor =
304           MethodDescriptor.<CompleteNodePoolUpgradeRequest, Empty>newBuilder()
305               .setType(MethodDescriptor.MethodType.UNARY)
306               .setFullMethodName("google.container.v1.ClusterManager/CompleteNodePoolUpgrade")
307               .setRequestMarshaller(
308                   ProtoUtils.marshaller(CompleteNodePoolUpgradeRequest.getDefaultInstance()))
309               .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
310               .build();
311 
312   private static final MethodDescriptor<RollbackNodePoolUpgradeRequest, Operation>
313       rollbackNodePoolUpgradeMethodDescriptor =
314           MethodDescriptor.<RollbackNodePoolUpgradeRequest, Operation>newBuilder()
315               .setType(MethodDescriptor.MethodType.UNARY)
316               .setFullMethodName("google.container.v1.ClusterManager/RollbackNodePoolUpgrade")
317               .setRequestMarshaller(
318                   ProtoUtils.marshaller(RollbackNodePoolUpgradeRequest.getDefaultInstance()))
319               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
320               .build();
321 
322   private static final MethodDescriptor<SetNodePoolManagementRequest, Operation>
323       setNodePoolManagementMethodDescriptor =
324           MethodDescriptor.<SetNodePoolManagementRequest, Operation>newBuilder()
325               .setType(MethodDescriptor.MethodType.UNARY)
326               .setFullMethodName("google.container.v1.ClusterManager/SetNodePoolManagement")
327               .setRequestMarshaller(
328                   ProtoUtils.marshaller(SetNodePoolManagementRequest.getDefaultInstance()))
329               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
330               .build();
331 
332   private static final MethodDescriptor<SetLabelsRequest, Operation> setLabelsMethodDescriptor =
333       MethodDescriptor.<SetLabelsRequest, Operation>newBuilder()
334           .setType(MethodDescriptor.MethodType.UNARY)
335           .setFullMethodName("google.container.v1.ClusterManager/SetLabels")
336           .setRequestMarshaller(ProtoUtils.marshaller(SetLabelsRequest.getDefaultInstance()))
337           .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
338           .build();
339 
340   private static final MethodDescriptor<SetLegacyAbacRequest, Operation>
341       setLegacyAbacMethodDescriptor =
342           MethodDescriptor.<SetLegacyAbacRequest, Operation>newBuilder()
343               .setType(MethodDescriptor.MethodType.UNARY)
344               .setFullMethodName("google.container.v1.ClusterManager/SetLegacyAbac")
345               .setRequestMarshaller(
346                   ProtoUtils.marshaller(SetLegacyAbacRequest.getDefaultInstance()))
347               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
348               .build();
349 
350   private static final MethodDescriptor<StartIPRotationRequest, Operation>
351       startIPRotationMethodDescriptor =
352           MethodDescriptor.<StartIPRotationRequest, Operation>newBuilder()
353               .setType(MethodDescriptor.MethodType.UNARY)
354               .setFullMethodName("google.container.v1.ClusterManager/StartIPRotation")
355               .setRequestMarshaller(
356                   ProtoUtils.marshaller(StartIPRotationRequest.getDefaultInstance()))
357               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
358               .build();
359 
360   private static final MethodDescriptor<CompleteIPRotationRequest, Operation>
361       completeIPRotationMethodDescriptor =
362           MethodDescriptor.<CompleteIPRotationRequest, Operation>newBuilder()
363               .setType(MethodDescriptor.MethodType.UNARY)
364               .setFullMethodName("google.container.v1.ClusterManager/CompleteIPRotation")
365               .setRequestMarshaller(
366                   ProtoUtils.marshaller(CompleteIPRotationRequest.getDefaultInstance()))
367               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
368               .build();
369 
370   private static final MethodDescriptor<SetNodePoolSizeRequest, Operation>
371       setNodePoolSizeMethodDescriptor =
372           MethodDescriptor.<SetNodePoolSizeRequest, Operation>newBuilder()
373               .setType(MethodDescriptor.MethodType.UNARY)
374               .setFullMethodName("google.container.v1.ClusterManager/SetNodePoolSize")
375               .setRequestMarshaller(
376                   ProtoUtils.marshaller(SetNodePoolSizeRequest.getDefaultInstance()))
377               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
378               .build();
379 
380   private static final MethodDescriptor<SetNetworkPolicyRequest, Operation>
381       setNetworkPolicyMethodDescriptor =
382           MethodDescriptor.<SetNetworkPolicyRequest, Operation>newBuilder()
383               .setType(MethodDescriptor.MethodType.UNARY)
384               .setFullMethodName("google.container.v1.ClusterManager/SetNetworkPolicy")
385               .setRequestMarshaller(
386                   ProtoUtils.marshaller(SetNetworkPolicyRequest.getDefaultInstance()))
387               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
388               .build();
389 
390   private static final MethodDescriptor<SetMaintenancePolicyRequest, Operation>
391       setMaintenancePolicyMethodDescriptor =
392           MethodDescriptor.<SetMaintenancePolicyRequest, Operation>newBuilder()
393               .setType(MethodDescriptor.MethodType.UNARY)
394               .setFullMethodName("google.container.v1.ClusterManager/SetMaintenancePolicy")
395               .setRequestMarshaller(
396                   ProtoUtils.marshaller(SetMaintenancePolicyRequest.getDefaultInstance()))
397               .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
398               .build();
399 
400   private static final MethodDescriptor<ListUsableSubnetworksRequest, ListUsableSubnetworksResponse>
401       listUsableSubnetworksMethodDescriptor =
402           MethodDescriptor.<ListUsableSubnetworksRequest, ListUsableSubnetworksResponse>newBuilder()
403               .setType(MethodDescriptor.MethodType.UNARY)
404               .setFullMethodName("google.container.v1.ClusterManager/ListUsableSubnetworks")
405               .setRequestMarshaller(
406                   ProtoUtils.marshaller(ListUsableSubnetworksRequest.getDefaultInstance()))
407               .setResponseMarshaller(
408                   ProtoUtils.marshaller(ListUsableSubnetworksResponse.getDefaultInstance()))
409               .build();
410 
411   private final UnaryCallable<ListClustersRequest, ListClustersResponse> listClustersCallable;
412   private final UnaryCallable<GetClusterRequest, Cluster> getClusterCallable;
413   private final UnaryCallable<CreateClusterRequest, Operation> createClusterCallable;
414   private final UnaryCallable<UpdateClusterRequest, Operation> updateClusterCallable;
415   private final UnaryCallable<UpdateNodePoolRequest, Operation> updateNodePoolCallable;
416   private final UnaryCallable<SetNodePoolAutoscalingRequest, Operation>
417       setNodePoolAutoscalingCallable;
418   private final UnaryCallable<SetLoggingServiceRequest, Operation> setLoggingServiceCallable;
419   private final UnaryCallable<SetMonitoringServiceRequest, Operation> setMonitoringServiceCallable;
420   private final UnaryCallable<SetAddonsConfigRequest, Operation> setAddonsConfigCallable;
421   private final UnaryCallable<SetLocationsRequest, Operation> setLocationsCallable;
422   private final UnaryCallable<UpdateMasterRequest, Operation> updateMasterCallable;
423   private final UnaryCallable<SetMasterAuthRequest, Operation> setMasterAuthCallable;
424   private final UnaryCallable<DeleteClusterRequest, Operation> deleteClusterCallable;
425   private final UnaryCallable<ListOperationsRequest, ListOperationsResponse> listOperationsCallable;
426   private final UnaryCallable<GetOperationRequest, Operation> getOperationCallable;
427   private final UnaryCallable<CancelOperationRequest, Empty> cancelOperationCallable;
428   private final UnaryCallable<GetServerConfigRequest, ServerConfig> getServerConfigCallable;
429   private final UnaryCallable<GetJSONWebKeysRequest, GetJSONWebKeysResponse> getJSONWebKeysCallable;
430   private final UnaryCallable<ListNodePoolsRequest, ListNodePoolsResponse> listNodePoolsCallable;
431   private final UnaryCallable<GetNodePoolRequest, NodePool> getNodePoolCallable;
432   private final UnaryCallable<CreateNodePoolRequest, Operation> createNodePoolCallable;
433   private final UnaryCallable<DeleteNodePoolRequest, Operation> deleteNodePoolCallable;
434   private final UnaryCallable<CompleteNodePoolUpgradeRequest, Empty>
435       completeNodePoolUpgradeCallable;
436   private final UnaryCallable<RollbackNodePoolUpgradeRequest, Operation>
437       rollbackNodePoolUpgradeCallable;
438   private final UnaryCallable<SetNodePoolManagementRequest, Operation>
439       setNodePoolManagementCallable;
440   private final UnaryCallable<SetLabelsRequest, Operation> setLabelsCallable;
441   private final UnaryCallable<SetLegacyAbacRequest, Operation> setLegacyAbacCallable;
442   private final UnaryCallable<StartIPRotationRequest, Operation> startIPRotationCallable;
443   private final UnaryCallable<CompleteIPRotationRequest, Operation> completeIPRotationCallable;
444   private final UnaryCallable<SetNodePoolSizeRequest, Operation> setNodePoolSizeCallable;
445   private final UnaryCallable<SetNetworkPolicyRequest, Operation> setNetworkPolicyCallable;
446   private final UnaryCallable<SetMaintenancePolicyRequest, Operation> setMaintenancePolicyCallable;
447   private final UnaryCallable<ListUsableSubnetworksRequest, ListUsableSubnetworksResponse>
448       listUsableSubnetworksCallable;
449   private final UnaryCallable<ListUsableSubnetworksRequest, ListUsableSubnetworksPagedResponse>
450       listUsableSubnetworksPagedCallable;
451 
452   private final BackgroundResource backgroundResources;
453   private final GrpcOperationsStub operationsStub;
454   private final GrpcStubCallableFactory callableFactory;
455 
create(ClusterManagerStubSettings settings)456   public static final GrpcClusterManagerStub create(ClusterManagerStubSettings settings)
457       throws IOException {
458     return new GrpcClusterManagerStub(settings, ClientContext.create(settings));
459   }
460 
create(ClientContext clientContext)461   public static final GrpcClusterManagerStub create(ClientContext clientContext)
462       throws IOException {
463     return new GrpcClusterManagerStub(
464         ClusterManagerStubSettings.newBuilder().build(), clientContext);
465   }
466 
create( ClientContext clientContext, GrpcStubCallableFactory callableFactory)467   public static final GrpcClusterManagerStub create(
468       ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
469     return new GrpcClusterManagerStub(
470         ClusterManagerStubSettings.newBuilder().build(), clientContext, callableFactory);
471   }
472 
473   /**
474    * Constructs an instance of GrpcClusterManagerStub, using the given settings. This is protected
475    * so that it is easy to make a subclass, but otherwise, the static factory methods should be
476    * preferred.
477    */
GrpcClusterManagerStub(ClusterManagerStubSettings settings, ClientContext clientContext)478   protected GrpcClusterManagerStub(ClusterManagerStubSettings settings, ClientContext clientContext)
479       throws IOException {
480     this(settings, clientContext, new GrpcClusterManagerCallableFactory());
481   }
482 
483   /**
484    * Constructs an instance of GrpcClusterManagerStub, using the given settings. This is protected
485    * so that it is easy to make a subclass, but otherwise, the static factory methods should be
486    * preferred.
487    */
GrpcClusterManagerStub( ClusterManagerStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory)488   protected GrpcClusterManagerStub(
489       ClusterManagerStubSettings settings,
490       ClientContext clientContext,
491       GrpcStubCallableFactory callableFactory)
492       throws IOException {
493     this.callableFactory = callableFactory;
494     this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
495 
496     GrpcCallSettings<ListClustersRequest, ListClustersResponse> listClustersTransportSettings =
497         GrpcCallSettings.<ListClustersRequest, ListClustersResponse>newBuilder()
498             .setMethodDescriptor(listClustersMethodDescriptor)
499             .setParamsExtractor(
500                 request -> {
501                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
502                   params.put("parent", String.valueOf(request.getParent()));
503                   params.put("project_id", String.valueOf(request.getProjectId()));
504                   params.put("zone", String.valueOf(request.getZone()));
505                   return params.build();
506                 })
507             .build();
508     GrpcCallSettings<GetClusterRequest, Cluster> getClusterTransportSettings =
509         GrpcCallSettings.<GetClusterRequest, Cluster>newBuilder()
510             .setMethodDescriptor(getClusterMethodDescriptor)
511             .setParamsExtractor(
512                 request -> {
513                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
514                   params.put("cluster_id", String.valueOf(request.getClusterId()));
515                   params.put("name", String.valueOf(request.getName()));
516                   params.put("project_id", String.valueOf(request.getProjectId()));
517                   params.put("zone", String.valueOf(request.getZone()));
518                   return params.build();
519                 })
520             .build();
521     GrpcCallSettings<CreateClusterRequest, Operation> createClusterTransportSettings =
522         GrpcCallSettings.<CreateClusterRequest, Operation>newBuilder()
523             .setMethodDescriptor(createClusterMethodDescriptor)
524             .setParamsExtractor(
525                 request -> {
526                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
527                   params.put("parent", String.valueOf(request.getParent()));
528                   params.put("project_id", String.valueOf(request.getProjectId()));
529                   params.put("zone", String.valueOf(request.getZone()));
530                   return params.build();
531                 })
532             .build();
533     GrpcCallSettings<UpdateClusterRequest, Operation> updateClusterTransportSettings =
534         GrpcCallSettings.<UpdateClusterRequest, Operation>newBuilder()
535             .setMethodDescriptor(updateClusterMethodDescriptor)
536             .setParamsExtractor(
537                 request -> {
538                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
539                   params.put("cluster_id", String.valueOf(request.getClusterId()));
540                   params.put("name", String.valueOf(request.getName()));
541                   params.put("project_id", String.valueOf(request.getProjectId()));
542                   params.put("zone", String.valueOf(request.getZone()));
543                   return params.build();
544                 })
545             .build();
546     GrpcCallSettings<UpdateNodePoolRequest, Operation> updateNodePoolTransportSettings =
547         GrpcCallSettings.<UpdateNodePoolRequest, Operation>newBuilder()
548             .setMethodDescriptor(updateNodePoolMethodDescriptor)
549             .setParamsExtractor(
550                 request -> {
551                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
552                   params.put("cluster_id", String.valueOf(request.getClusterId()));
553                   params.put("name", String.valueOf(request.getName()));
554                   params.put("node_pool_id", String.valueOf(request.getNodePoolId()));
555                   params.put("project_id", String.valueOf(request.getProjectId()));
556                   params.put("zone", String.valueOf(request.getZone()));
557                   return params.build();
558                 })
559             .build();
560     GrpcCallSettings<SetNodePoolAutoscalingRequest, Operation>
561         setNodePoolAutoscalingTransportSettings =
562             GrpcCallSettings.<SetNodePoolAutoscalingRequest, Operation>newBuilder()
563                 .setMethodDescriptor(setNodePoolAutoscalingMethodDescriptor)
564                 .setParamsExtractor(
565                     request -> {
566                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
567                       params.put("cluster_id", String.valueOf(request.getClusterId()));
568                       params.put("name", String.valueOf(request.getName()));
569                       params.put("node_pool_id", String.valueOf(request.getNodePoolId()));
570                       params.put("project_id", String.valueOf(request.getProjectId()));
571                       params.put("zone", String.valueOf(request.getZone()));
572                       return params.build();
573                     })
574                 .build();
575     GrpcCallSettings<SetLoggingServiceRequest, Operation> setLoggingServiceTransportSettings =
576         GrpcCallSettings.<SetLoggingServiceRequest, Operation>newBuilder()
577             .setMethodDescriptor(setLoggingServiceMethodDescriptor)
578             .setParamsExtractor(
579                 request -> {
580                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
581                   params.put("cluster_id", String.valueOf(request.getClusterId()));
582                   params.put("name", String.valueOf(request.getName()));
583                   params.put("project_id", String.valueOf(request.getProjectId()));
584                   params.put("zone", String.valueOf(request.getZone()));
585                   return params.build();
586                 })
587             .build();
588     GrpcCallSettings<SetMonitoringServiceRequest, Operation> setMonitoringServiceTransportSettings =
589         GrpcCallSettings.<SetMonitoringServiceRequest, Operation>newBuilder()
590             .setMethodDescriptor(setMonitoringServiceMethodDescriptor)
591             .setParamsExtractor(
592                 request -> {
593                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
594                   params.put("cluster_id", String.valueOf(request.getClusterId()));
595                   params.put("name", String.valueOf(request.getName()));
596                   params.put("project_id", String.valueOf(request.getProjectId()));
597                   params.put("zone", String.valueOf(request.getZone()));
598                   return params.build();
599                 })
600             .build();
601     GrpcCallSettings<SetAddonsConfigRequest, Operation> setAddonsConfigTransportSettings =
602         GrpcCallSettings.<SetAddonsConfigRequest, Operation>newBuilder()
603             .setMethodDescriptor(setAddonsConfigMethodDescriptor)
604             .setParamsExtractor(
605                 request -> {
606                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
607                   params.put("cluster_id", String.valueOf(request.getClusterId()));
608                   params.put("name", String.valueOf(request.getName()));
609                   params.put("project_id", String.valueOf(request.getProjectId()));
610                   params.put("zone", String.valueOf(request.getZone()));
611                   return params.build();
612                 })
613             .build();
614     GrpcCallSettings<SetLocationsRequest, Operation> setLocationsTransportSettings =
615         GrpcCallSettings.<SetLocationsRequest, Operation>newBuilder()
616             .setMethodDescriptor(setLocationsMethodDescriptor)
617             .setParamsExtractor(
618                 request -> {
619                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
620                   params.put("cluster_id", String.valueOf(request.getClusterId()));
621                   params.put("name", String.valueOf(request.getName()));
622                   params.put("project_id", String.valueOf(request.getProjectId()));
623                   params.put("zone", String.valueOf(request.getZone()));
624                   return params.build();
625                 })
626             .build();
627     GrpcCallSettings<UpdateMasterRequest, Operation> updateMasterTransportSettings =
628         GrpcCallSettings.<UpdateMasterRequest, Operation>newBuilder()
629             .setMethodDescriptor(updateMasterMethodDescriptor)
630             .setParamsExtractor(
631                 request -> {
632                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
633                   params.put("cluster_id", String.valueOf(request.getClusterId()));
634                   params.put("name", String.valueOf(request.getName()));
635                   params.put("project_id", String.valueOf(request.getProjectId()));
636                   params.put("zone", String.valueOf(request.getZone()));
637                   return params.build();
638                 })
639             .build();
640     GrpcCallSettings<SetMasterAuthRequest, Operation> setMasterAuthTransportSettings =
641         GrpcCallSettings.<SetMasterAuthRequest, Operation>newBuilder()
642             .setMethodDescriptor(setMasterAuthMethodDescriptor)
643             .setParamsExtractor(
644                 request -> {
645                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
646                   params.put("cluster_id", String.valueOf(request.getClusterId()));
647                   params.put("name", String.valueOf(request.getName()));
648                   params.put("project_id", String.valueOf(request.getProjectId()));
649                   params.put("zone", String.valueOf(request.getZone()));
650                   return params.build();
651                 })
652             .build();
653     GrpcCallSettings<DeleteClusterRequest, Operation> deleteClusterTransportSettings =
654         GrpcCallSettings.<DeleteClusterRequest, Operation>newBuilder()
655             .setMethodDescriptor(deleteClusterMethodDescriptor)
656             .setParamsExtractor(
657                 request -> {
658                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
659                   params.put("cluster_id", String.valueOf(request.getClusterId()));
660                   params.put("name", String.valueOf(request.getName()));
661                   params.put("project_id", String.valueOf(request.getProjectId()));
662                   params.put("zone", String.valueOf(request.getZone()));
663                   return params.build();
664                 })
665             .build();
666     GrpcCallSettings<ListOperationsRequest, ListOperationsResponse>
667         listOperationsTransportSettings =
668             GrpcCallSettings.<ListOperationsRequest, ListOperationsResponse>newBuilder()
669                 .setMethodDescriptor(listOperationsMethodDescriptor)
670                 .setParamsExtractor(
671                     request -> {
672                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
673                       params.put("parent", String.valueOf(request.getParent()));
674                       params.put("project_id", String.valueOf(request.getProjectId()));
675                       params.put("zone", String.valueOf(request.getZone()));
676                       return params.build();
677                     })
678                 .build();
679     GrpcCallSettings<GetOperationRequest, Operation> getOperationTransportSettings =
680         GrpcCallSettings.<GetOperationRequest, Operation>newBuilder()
681             .setMethodDescriptor(getOperationMethodDescriptor)
682             .setParamsExtractor(
683                 request -> {
684                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
685                   params.put("name", String.valueOf(request.getName()));
686                   params.put("operation_id", String.valueOf(request.getOperationId()));
687                   params.put("project_id", String.valueOf(request.getProjectId()));
688                   params.put("zone", String.valueOf(request.getZone()));
689                   return params.build();
690                 })
691             .build();
692     GrpcCallSettings<CancelOperationRequest, Empty> cancelOperationTransportSettings =
693         GrpcCallSettings.<CancelOperationRequest, Empty>newBuilder()
694             .setMethodDescriptor(cancelOperationMethodDescriptor)
695             .setParamsExtractor(
696                 request -> {
697                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
698                   params.put("name", String.valueOf(request.getName()));
699                   params.put("operation_id", String.valueOf(request.getOperationId()));
700                   params.put("project_id", String.valueOf(request.getProjectId()));
701                   params.put("zone", String.valueOf(request.getZone()));
702                   return params.build();
703                 })
704             .build();
705     GrpcCallSettings<GetServerConfigRequest, ServerConfig> getServerConfigTransportSettings =
706         GrpcCallSettings.<GetServerConfigRequest, ServerConfig>newBuilder()
707             .setMethodDescriptor(getServerConfigMethodDescriptor)
708             .setParamsExtractor(
709                 request -> {
710                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
711                   params.put("name", String.valueOf(request.getName()));
712                   params.put("project_id", String.valueOf(request.getProjectId()));
713                   params.put("zone", String.valueOf(request.getZone()));
714                   return params.build();
715                 })
716             .build();
717     GrpcCallSettings<GetJSONWebKeysRequest, GetJSONWebKeysResponse>
718         getJSONWebKeysTransportSettings =
719             GrpcCallSettings.<GetJSONWebKeysRequest, GetJSONWebKeysResponse>newBuilder()
720                 .setMethodDescriptor(getJSONWebKeysMethodDescriptor)
721                 .setParamsExtractor(
722                     request -> {
723                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
724                       params.put("parent", String.valueOf(request.getParent()));
725                       return params.build();
726                     })
727                 .build();
728     GrpcCallSettings<ListNodePoolsRequest, ListNodePoolsResponse> listNodePoolsTransportSettings =
729         GrpcCallSettings.<ListNodePoolsRequest, ListNodePoolsResponse>newBuilder()
730             .setMethodDescriptor(listNodePoolsMethodDescriptor)
731             .setParamsExtractor(
732                 request -> {
733                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
734                   params.put("cluster_id", String.valueOf(request.getClusterId()));
735                   params.put("parent", String.valueOf(request.getParent()));
736                   params.put("project_id", String.valueOf(request.getProjectId()));
737                   params.put("zone", String.valueOf(request.getZone()));
738                   return params.build();
739                 })
740             .build();
741     GrpcCallSettings<GetNodePoolRequest, NodePool> getNodePoolTransportSettings =
742         GrpcCallSettings.<GetNodePoolRequest, NodePool>newBuilder()
743             .setMethodDescriptor(getNodePoolMethodDescriptor)
744             .setParamsExtractor(
745                 request -> {
746                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
747                   params.put("cluster_id", String.valueOf(request.getClusterId()));
748                   params.put("name", String.valueOf(request.getName()));
749                   params.put("node_pool_id", String.valueOf(request.getNodePoolId()));
750                   params.put("project_id", String.valueOf(request.getProjectId()));
751                   params.put("zone", String.valueOf(request.getZone()));
752                   return params.build();
753                 })
754             .build();
755     GrpcCallSettings<CreateNodePoolRequest, Operation> createNodePoolTransportSettings =
756         GrpcCallSettings.<CreateNodePoolRequest, Operation>newBuilder()
757             .setMethodDescriptor(createNodePoolMethodDescriptor)
758             .setParamsExtractor(
759                 request -> {
760                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
761                   params.put("cluster_id", String.valueOf(request.getClusterId()));
762                   params.put("parent", String.valueOf(request.getParent()));
763                   params.put("project_id", String.valueOf(request.getProjectId()));
764                   params.put("zone", String.valueOf(request.getZone()));
765                   return params.build();
766                 })
767             .build();
768     GrpcCallSettings<DeleteNodePoolRequest, Operation> deleteNodePoolTransportSettings =
769         GrpcCallSettings.<DeleteNodePoolRequest, Operation>newBuilder()
770             .setMethodDescriptor(deleteNodePoolMethodDescriptor)
771             .setParamsExtractor(
772                 request -> {
773                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
774                   params.put("cluster_id", String.valueOf(request.getClusterId()));
775                   params.put("name", String.valueOf(request.getName()));
776                   params.put("node_pool_id", String.valueOf(request.getNodePoolId()));
777                   params.put("project_id", String.valueOf(request.getProjectId()));
778                   params.put("zone", String.valueOf(request.getZone()));
779                   return params.build();
780                 })
781             .build();
782     GrpcCallSettings<CompleteNodePoolUpgradeRequest, Empty>
783         completeNodePoolUpgradeTransportSettings =
784             GrpcCallSettings.<CompleteNodePoolUpgradeRequest, Empty>newBuilder()
785                 .setMethodDescriptor(completeNodePoolUpgradeMethodDescriptor)
786                 .setParamsExtractor(
787                     request -> {
788                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
789                       params.put("name", String.valueOf(request.getName()));
790                       return params.build();
791                     })
792                 .build();
793     GrpcCallSettings<RollbackNodePoolUpgradeRequest, Operation>
794         rollbackNodePoolUpgradeTransportSettings =
795             GrpcCallSettings.<RollbackNodePoolUpgradeRequest, Operation>newBuilder()
796                 .setMethodDescriptor(rollbackNodePoolUpgradeMethodDescriptor)
797                 .setParamsExtractor(
798                     request -> {
799                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
800                       params.put("cluster_id", String.valueOf(request.getClusterId()));
801                       params.put("name", String.valueOf(request.getName()));
802                       params.put("node_pool_id", String.valueOf(request.getNodePoolId()));
803                       params.put("project_id", String.valueOf(request.getProjectId()));
804                       params.put("zone", String.valueOf(request.getZone()));
805                       return params.build();
806                     })
807                 .build();
808     GrpcCallSettings<SetNodePoolManagementRequest, Operation>
809         setNodePoolManagementTransportSettings =
810             GrpcCallSettings.<SetNodePoolManagementRequest, Operation>newBuilder()
811                 .setMethodDescriptor(setNodePoolManagementMethodDescriptor)
812                 .setParamsExtractor(
813                     request -> {
814                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
815                       params.put("cluster_id", String.valueOf(request.getClusterId()));
816                       params.put("name", String.valueOf(request.getName()));
817                       params.put("node_pool_id", String.valueOf(request.getNodePoolId()));
818                       params.put("project_id", String.valueOf(request.getProjectId()));
819                       params.put("zone", String.valueOf(request.getZone()));
820                       return params.build();
821                     })
822                 .build();
823     GrpcCallSettings<SetLabelsRequest, Operation> setLabelsTransportSettings =
824         GrpcCallSettings.<SetLabelsRequest, Operation>newBuilder()
825             .setMethodDescriptor(setLabelsMethodDescriptor)
826             .setParamsExtractor(
827                 request -> {
828                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
829                   params.put("cluster_id", String.valueOf(request.getClusterId()));
830                   params.put("name", String.valueOf(request.getName()));
831                   params.put("project_id", String.valueOf(request.getProjectId()));
832                   params.put("zone", String.valueOf(request.getZone()));
833                   return params.build();
834                 })
835             .build();
836     GrpcCallSettings<SetLegacyAbacRequest, Operation> setLegacyAbacTransportSettings =
837         GrpcCallSettings.<SetLegacyAbacRequest, Operation>newBuilder()
838             .setMethodDescriptor(setLegacyAbacMethodDescriptor)
839             .setParamsExtractor(
840                 request -> {
841                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
842                   params.put("cluster_id", String.valueOf(request.getClusterId()));
843                   params.put("name", String.valueOf(request.getName()));
844                   params.put("project_id", String.valueOf(request.getProjectId()));
845                   params.put("zone", String.valueOf(request.getZone()));
846                   return params.build();
847                 })
848             .build();
849     GrpcCallSettings<StartIPRotationRequest, Operation> startIPRotationTransportSettings =
850         GrpcCallSettings.<StartIPRotationRequest, Operation>newBuilder()
851             .setMethodDescriptor(startIPRotationMethodDescriptor)
852             .setParamsExtractor(
853                 request -> {
854                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
855                   params.put("cluster_id", String.valueOf(request.getClusterId()));
856                   params.put("name", String.valueOf(request.getName()));
857                   params.put("project_id", String.valueOf(request.getProjectId()));
858                   params.put("zone", String.valueOf(request.getZone()));
859                   return params.build();
860                 })
861             .build();
862     GrpcCallSettings<CompleteIPRotationRequest, Operation> completeIPRotationTransportSettings =
863         GrpcCallSettings.<CompleteIPRotationRequest, Operation>newBuilder()
864             .setMethodDescriptor(completeIPRotationMethodDescriptor)
865             .setParamsExtractor(
866                 request -> {
867                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
868                   params.put("cluster_id", String.valueOf(request.getClusterId()));
869                   params.put("name", String.valueOf(request.getName()));
870                   params.put("project_id", String.valueOf(request.getProjectId()));
871                   params.put("zone", String.valueOf(request.getZone()));
872                   return params.build();
873                 })
874             .build();
875     GrpcCallSettings<SetNodePoolSizeRequest, Operation> setNodePoolSizeTransportSettings =
876         GrpcCallSettings.<SetNodePoolSizeRequest, Operation>newBuilder()
877             .setMethodDescriptor(setNodePoolSizeMethodDescriptor)
878             .setParamsExtractor(
879                 request -> {
880                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
881                   params.put("cluster_id", String.valueOf(request.getClusterId()));
882                   params.put("name", String.valueOf(request.getName()));
883                   params.put("node_pool_id", String.valueOf(request.getNodePoolId()));
884                   params.put("project_id", String.valueOf(request.getProjectId()));
885                   params.put("zone", String.valueOf(request.getZone()));
886                   return params.build();
887                 })
888             .build();
889     GrpcCallSettings<SetNetworkPolicyRequest, Operation> setNetworkPolicyTransportSettings =
890         GrpcCallSettings.<SetNetworkPolicyRequest, Operation>newBuilder()
891             .setMethodDescriptor(setNetworkPolicyMethodDescriptor)
892             .setParamsExtractor(
893                 request -> {
894                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
895                   params.put("cluster_id", String.valueOf(request.getClusterId()));
896                   params.put("name", String.valueOf(request.getName()));
897                   params.put("project_id", String.valueOf(request.getProjectId()));
898                   params.put("zone", String.valueOf(request.getZone()));
899                   return params.build();
900                 })
901             .build();
902     GrpcCallSettings<SetMaintenancePolicyRequest, Operation> setMaintenancePolicyTransportSettings =
903         GrpcCallSettings.<SetMaintenancePolicyRequest, Operation>newBuilder()
904             .setMethodDescriptor(setMaintenancePolicyMethodDescriptor)
905             .setParamsExtractor(
906                 request -> {
907                   ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
908                   params.put("cluster_id", String.valueOf(request.getClusterId()));
909                   params.put("name", String.valueOf(request.getName()));
910                   params.put("project_id", String.valueOf(request.getProjectId()));
911                   params.put("zone", String.valueOf(request.getZone()));
912                   return params.build();
913                 })
914             .build();
915     GrpcCallSettings<ListUsableSubnetworksRequest, ListUsableSubnetworksResponse>
916         listUsableSubnetworksTransportSettings =
917             GrpcCallSettings
918                 .<ListUsableSubnetworksRequest, ListUsableSubnetworksResponse>newBuilder()
919                 .setMethodDescriptor(listUsableSubnetworksMethodDescriptor)
920                 .setParamsExtractor(
921                     request -> {
922                       ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
923                       params.put("parent", String.valueOf(request.getParent()));
924                       return params.build();
925                     })
926                 .build();
927 
928     this.listClustersCallable =
929         callableFactory.createUnaryCallable(
930             listClustersTransportSettings, settings.listClustersSettings(), clientContext);
931     this.getClusterCallable =
932         callableFactory.createUnaryCallable(
933             getClusterTransportSettings, settings.getClusterSettings(), clientContext);
934     this.createClusterCallable =
935         callableFactory.createUnaryCallable(
936             createClusterTransportSettings, settings.createClusterSettings(), clientContext);
937     this.updateClusterCallable =
938         callableFactory.createUnaryCallable(
939             updateClusterTransportSettings, settings.updateClusterSettings(), clientContext);
940     this.updateNodePoolCallable =
941         callableFactory.createUnaryCallable(
942             updateNodePoolTransportSettings, settings.updateNodePoolSettings(), clientContext);
943     this.setNodePoolAutoscalingCallable =
944         callableFactory.createUnaryCallable(
945             setNodePoolAutoscalingTransportSettings,
946             settings.setNodePoolAutoscalingSettings(),
947             clientContext);
948     this.setLoggingServiceCallable =
949         callableFactory.createUnaryCallable(
950             setLoggingServiceTransportSettings,
951             settings.setLoggingServiceSettings(),
952             clientContext);
953     this.setMonitoringServiceCallable =
954         callableFactory.createUnaryCallable(
955             setMonitoringServiceTransportSettings,
956             settings.setMonitoringServiceSettings(),
957             clientContext);
958     this.setAddonsConfigCallable =
959         callableFactory.createUnaryCallable(
960             setAddonsConfigTransportSettings, settings.setAddonsConfigSettings(), clientContext);
961     this.setLocationsCallable =
962         callableFactory.createUnaryCallable(
963             setLocationsTransportSettings, settings.setLocationsSettings(), clientContext);
964     this.updateMasterCallable =
965         callableFactory.createUnaryCallable(
966             updateMasterTransportSettings, settings.updateMasterSettings(), clientContext);
967     this.setMasterAuthCallable =
968         callableFactory.createUnaryCallable(
969             setMasterAuthTransportSettings, settings.setMasterAuthSettings(), clientContext);
970     this.deleteClusterCallable =
971         callableFactory.createUnaryCallable(
972             deleteClusterTransportSettings, settings.deleteClusterSettings(), clientContext);
973     this.listOperationsCallable =
974         callableFactory.createUnaryCallable(
975             listOperationsTransportSettings, settings.listOperationsSettings(), clientContext);
976     this.getOperationCallable =
977         callableFactory.createUnaryCallable(
978             getOperationTransportSettings, settings.getOperationSettings(), clientContext);
979     this.cancelOperationCallable =
980         callableFactory.createUnaryCallable(
981             cancelOperationTransportSettings, settings.cancelOperationSettings(), clientContext);
982     this.getServerConfigCallable =
983         callableFactory.createUnaryCallable(
984             getServerConfigTransportSettings, settings.getServerConfigSettings(), clientContext);
985     this.getJSONWebKeysCallable =
986         callableFactory.createUnaryCallable(
987             getJSONWebKeysTransportSettings, settings.getJSONWebKeysSettings(), clientContext);
988     this.listNodePoolsCallable =
989         callableFactory.createUnaryCallable(
990             listNodePoolsTransportSettings, settings.listNodePoolsSettings(), clientContext);
991     this.getNodePoolCallable =
992         callableFactory.createUnaryCallable(
993             getNodePoolTransportSettings, settings.getNodePoolSettings(), clientContext);
994     this.createNodePoolCallable =
995         callableFactory.createUnaryCallable(
996             createNodePoolTransportSettings, settings.createNodePoolSettings(), clientContext);
997     this.deleteNodePoolCallable =
998         callableFactory.createUnaryCallable(
999             deleteNodePoolTransportSettings, settings.deleteNodePoolSettings(), clientContext);
1000     this.completeNodePoolUpgradeCallable =
1001         callableFactory.createUnaryCallable(
1002             completeNodePoolUpgradeTransportSettings,
1003             settings.completeNodePoolUpgradeSettings(),
1004             clientContext);
1005     this.rollbackNodePoolUpgradeCallable =
1006         callableFactory.createUnaryCallable(
1007             rollbackNodePoolUpgradeTransportSettings,
1008             settings.rollbackNodePoolUpgradeSettings(),
1009             clientContext);
1010     this.setNodePoolManagementCallable =
1011         callableFactory.createUnaryCallable(
1012             setNodePoolManagementTransportSettings,
1013             settings.setNodePoolManagementSettings(),
1014             clientContext);
1015     this.setLabelsCallable =
1016         callableFactory.createUnaryCallable(
1017             setLabelsTransportSettings, settings.setLabelsSettings(), clientContext);
1018     this.setLegacyAbacCallable =
1019         callableFactory.createUnaryCallable(
1020             setLegacyAbacTransportSettings, settings.setLegacyAbacSettings(), clientContext);
1021     this.startIPRotationCallable =
1022         callableFactory.createUnaryCallable(
1023             startIPRotationTransportSettings, settings.startIPRotationSettings(), clientContext);
1024     this.completeIPRotationCallable =
1025         callableFactory.createUnaryCallable(
1026             completeIPRotationTransportSettings,
1027             settings.completeIPRotationSettings(),
1028             clientContext);
1029     this.setNodePoolSizeCallable =
1030         callableFactory.createUnaryCallable(
1031             setNodePoolSizeTransportSettings, settings.setNodePoolSizeSettings(), clientContext);
1032     this.setNetworkPolicyCallable =
1033         callableFactory.createUnaryCallable(
1034             setNetworkPolicyTransportSettings, settings.setNetworkPolicySettings(), clientContext);
1035     this.setMaintenancePolicyCallable =
1036         callableFactory.createUnaryCallable(
1037             setMaintenancePolicyTransportSettings,
1038             settings.setMaintenancePolicySettings(),
1039             clientContext);
1040     this.listUsableSubnetworksCallable =
1041         callableFactory.createUnaryCallable(
1042             listUsableSubnetworksTransportSettings,
1043             settings.listUsableSubnetworksSettings(),
1044             clientContext);
1045     this.listUsableSubnetworksPagedCallable =
1046         callableFactory.createPagedCallable(
1047             listUsableSubnetworksTransportSettings,
1048             settings.listUsableSubnetworksSettings(),
1049             clientContext);
1050 
1051     this.backgroundResources =
1052         new BackgroundResourceAggregation(clientContext.getBackgroundResources());
1053   }
1054 
getOperationsStub()1055   public GrpcOperationsStub getOperationsStub() {
1056     return operationsStub;
1057   }
1058 
1059   @Override
listClustersCallable()1060   public UnaryCallable<ListClustersRequest, ListClustersResponse> listClustersCallable() {
1061     return listClustersCallable;
1062   }
1063 
1064   @Override
getClusterCallable()1065   public UnaryCallable<GetClusterRequest, Cluster> getClusterCallable() {
1066     return getClusterCallable;
1067   }
1068 
1069   @Override
createClusterCallable()1070   public UnaryCallable<CreateClusterRequest, Operation> createClusterCallable() {
1071     return createClusterCallable;
1072   }
1073 
1074   @Override
updateClusterCallable()1075   public UnaryCallable<UpdateClusterRequest, Operation> updateClusterCallable() {
1076     return updateClusterCallable;
1077   }
1078 
1079   @Override
updateNodePoolCallable()1080   public UnaryCallable<UpdateNodePoolRequest, Operation> updateNodePoolCallable() {
1081     return updateNodePoolCallable;
1082   }
1083 
1084   @Override
setNodePoolAutoscalingCallable()1085   public UnaryCallable<SetNodePoolAutoscalingRequest, Operation> setNodePoolAutoscalingCallable() {
1086     return setNodePoolAutoscalingCallable;
1087   }
1088 
1089   @Override
setLoggingServiceCallable()1090   public UnaryCallable<SetLoggingServiceRequest, Operation> setLoggingServiceCallable() {
1091     return setLoggingServiceCallable;
1092   }
1093 
1094   @Override
setMonitoringServiceCallable()1095   public UnaryCallable<SetMonitoringServiceRequest, Operation> setMonitoringServiceCallable() {
1096     return setMonitoringServiceCallable;
1097   }
1098 
1099   @Override
setAddonsConfigCallable()1100   public UnaryCallable<SetAddonsConfigRequest, Operation> setAddonsConfigCallable() {
1101     return setAddonsConfigCallable;
1102   }
1103 
1104   @Override
setLocationsCallable()1105   public UnaryCallable<SetLocationsRequest, Operation> setLocationsCallable() {
1106     return setLocationsCallable;
1107   }
1108 
1109   @Override
updateMasterCallable()1110   public UnaryCallable<UpdateMasterRequest, Operation> updateMasterCallable() {
1111     return updateMasterCallable;
1112   }
1113 
1114   @Override
setMasterAuthCallable()1115   public UnaryCallable<SetMasterAuthRequest, Operation> setMasterAuthCallable() {
1116     return setMasterAuthCallable;
1117   }
1118 
1119   @Override
deleteClusterCallable()1120   public UnaryCallable<DeleteClusterRequest, Operation> deleteClusterCallable() {
1121     return deleteClusterCallable;
1122   }
1123 
1124   @Override
listOperationsCallable()1125   public UnaryCallable<ListOperationsRequest, ListOperationsResponse> listOperationsCallable() {
1126     return listOperationsCallable;
1127   }
1128 
1129   @Override
getOperationCallable()1130   public UnaryCallable<GetOperationRequest, Operation> getOperationCallable() {
1131     return getOperationCallable;
1132   }
1133 
1134   @Override
cancelOperationCallable()1135   public UnaryCallable<CancelOperationRequest, Empty> cancelOperationCallable() {
1136     return cancelOperationCallable;
1137   }
1138 
1139   @Override
getServerConfigCallable()1140   public UnaryCallable<GetServerConfigRequest, ServerConfig> getServerConfigCallable() {
1141     return getServerConfigCallable;
1142   }
1143 
1144   @Override
getJSONWebKeysCallable()1145   public UnaryCallable<GetJSONWebKeysRequest, GetJSONWebKeysResponse> getJSONWebKeysCallable() {
1146     return getJSONWebKeysCallable;
1147   }
1148 
1149   @Override
listNodePoolsCallable()1150   public UnaryCallable<ListNodePoolsRequest, ListNodePoolsResponse> listNodePoolsCallable() {
1151     return listNodePoolsCallable;
1152   }
1153 
1154   @Override
getNodePoolCallable()1155   public UnaryCallable<GetNodePoolRequest, NodePool> getNodePoolCallable() {
1156     return getNodePoolCallable;
1157   }
1158 
1159   @Override
createNodePoolCallable()1160   public UnaryCallable<CreateNodePoolRequest, Operation> createNodePoolCallable() {
1161     return createNodePoolCallable;
1162   }
1163 
1164   @Override
deleteNodePoolCallable()1165   public UnaryCallable<DeleteNodePoolRequest, Operation> deleteNodePoolCallable() {
1166     return deleteNodePoolCallable;
1167   }
1168 
1169   @Override
completeNodePoolUpgradeCallable()1170   public UnaryCallable<CompleteNodePoolUpgradeRequest, Empty> completeNodePoolUpgradeCallable() {
1171     return completeNodePoolUpgradeCallable;
1172   }
1173 
1174   @Override
1175   public UnaryCallable<RollbackNodePoolUpgradeRequest, Operation>
rollbackNodePoolUpgradeCallable()1176       rollbackNodePoolUpgradeCallable() {
1177     return rollbackNodePoolUpgradeCallable;
1178   }
1179 
1180   @Override
setNodePoolManagementCallable()1181   public UnaryCallable<SetNodePoolManagementRequest, Operation> setNodePoolManagementCallable() {
1182     return setNodePoolManagementCallable;
1183   }
1184 
1185   @Override
setLabelsCallable()1186   public UnaryCallable<SetLabelsRequest, Operation> setLabelsCallable() {
1187     return setLabelsCallable;
1188   }
1189 
1190   @Override
setLegacyAbacCallable()1191   public UnaryCallable<SetLegacyAbacRequest, Operation> setLegacyAbacCallable() {
1192     return setLegacyAbacCallable;
1193   }
1194 
1195   @Override
startIPRotationCallable()1196   public UnaryCallable<StartIPRotationRequest, Operation> startIPRotationCallable() {
1197     return startIPRotationCallable;
1198   }
1199 
1200   @Override
completeIPRotationCallable()1201   public UnaryCallable<CompleteIPRotationRequest, Operation> completeIPRotationCallable() {
1202     return completeIPRotationCallable;
1203   }
1204 
1205   @Override
setNodePoolSizeCallable()1206   public UnaryCallable<SetNodePoolSizeRequest, Operation> setNodePoolSizeCallable() {
1207     return setNodePoolSizeCallable;
1208   }
1209 
1210   @Override
setNetworkPolicyCallable()1211   public UnaryCallable<SetNetworkPolicyRequest, Operation> setNetworkPolicyCallable() {
1212     return setNetworkPolicyCallable;
1213   }
1214 
1215   @Override
setMaintenancePolicyCallable()1216   public UnaryCallable<SetMaintenancePolicyRequest, Operation> setMaintenancePolicyCallable() {
1217     return setMaintenancePolicyCallable;
1218   }
1219 
1220   @Override
1221   public UnaryCallable<ListUsableSubnetworksRequest, ListUsableSubnetworksResponse>
listUsableSubnetworksCallable()1222       listUsableSubnetworksCallable() {
1223     return listUsableSubnetworksCallable;
1224   }
1225 
1226   @Override
1227   public UnaryCallable<ListUsableSubnetworksRequest, ListUsableSubnetworksPagedResponse>
listUsableSubnetworksPagedCallable()1228       listUsableSubnetworksPagedCallable() {
1229     return listUsableSubnetworksPagedCallable;
1230   }
1231 
1232   @Override
close()1233   public final void close() {
1234     try {
1235       backgroundResources.close();
1236     } catch (RuntimeException e) {
1237       throw e;
1238     } catch (Exception e) {
1239       throw new IllegalStateException("Failed to close resource", e);
1240     }
1241   }
1242 
1243   @Override
shutdown()1244   public void shutdown() {
1245     backgroundResources.shutdown();
1246   }
1247 
1248   @Override
isShutdown()1249   public boolean isShutdown() {
1250     return backgroundResources.isShutdown();
1251   }
1252 
1253   @Override
isTerminated()1254   public boolean isTerminated() {
1255     return backgroundResources.isTerminated();
1256   }
1257 
1258   @Override
shutdownNow()1259   public void shutdownNow() {
1260     backgroundResources.shutdownNow();
1261   }
1262 
1263   @Override
awaitTermination(long duration, TimeUnit unit)1264   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1265     return backgroundResources.awaitTermination(duration, unit);
1266   }
1267 }
1268