• 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.compute.v1.stub;
18 
19 import static com.google.cloud.compute.v1.NodeGroupsClient.AggregatedListPagedResponse;
20 import static com.google.cloud.compute.v1.NodeGroupsClient.ListNodesPagedResponse;
21 import static com.google.cloud.compute.v1.NodeGroupsClient.ListPagedResponse;
22 
23 import com.google.api.core.ApiFunction;
24 import com.google.api.core.ApiFuture;
25 import com.google.api.core.BetaApi;
26 import com.google.api.gax.core.GaxProperties;
27 import com.google.api.gax.core.GoogleCredentialsProvider;
28 import com.google.api.gax.core.InstantiatingExecutorProvider;
29 import com.google.api.gax.httpjson.GaxHttpJsonProperties;
30 import com.google.api.gax.httpjson.HttpJsonTransportChannel;
31 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
32 import com.google.api.gax.httpjson.ProtoOperationTransformers;
33 import com.google.api.gax.longrunning.OperationSnapshot;
34 import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
35 import com.google.api.gax.retrying.RetrySettings;
36 import com.google.api.gax.rpc.ApiCallContext;
37 import com.google.api.gax.rpc.ApiClientHeaderProvider;
38 import com.google.api.gax.rpc.ClientContext;
39 import com.google.api.gax.rpc.OperationCallSettings;
40 import com.google.api.gax.rpc.PageContext;
41 import com.google.api.gax.rpc.PagedCallSettings;
42 import com.google.api.gax.rpc.PagedListDescriptor;
43 import com.google.api.gax.rpc.PagedListResponseFactory;
44 import com.google.api.gax.rpc.StatusCode;
45 import com.google.api.gax.rpc.StubSettings;
46 import com.google.api.gax.rpc.TransportChannelProvider;
47 import com.google.api.gax.rpc.UnaryCallSettings;
48 import com.google.api.gax.rpc.UnaryCallable;
49 import com.google.cloud.compute.v1.AddNodesNodeGroupRequest;
50 import com.google.cloud.compute.v1.AggregatedListNodeGroupsRequest;
51 import com.google.cloud.compute.v1.DeleteNodeGroupRequest;
52 import com.google.cloud.compute.v1.DeleteNodesNodeGroupRequest;
53 import com.google.cloud.compute.v1.GetIamPolicyNodeGroupRequest;
54 import com.google.cloud.compute.v1.GetNodeGroupRequest;
55 import com.google.cloud.compute.v1.InsertNodeGroupRequest;
56 import com.google.cloud.compute.v1.ListNodeGroupsRequest;
57 import com.google.cloud.compute.v1.ListNodesNodeGroupsRequest;
58 import com.google.cloud.compute.v1.NodeGroup;
59 import com.google.cloud.compute.v1.NodeGroupAggregatedList;
60 import com.google.cloud.compute.v1.NodeGroupList;
61 import com.google.cloud.compute.v1.NodeGroupNode;
62 import com.google.cloud.compute.v1.NodeGroupsListNodes;
63 import com.google.cloud.compute.v1.NodeGroupsScopedList;
64 import com.google.cloud.compute.v1.Operation;
65 import com.google.cloud.compute.v1.PatchNodeGroupRequest;
66 import com.google.cloud.compute.v1.Policy;
67 import com.google.cloud.compute.v1.SetIamPolicyNodeGroupRequest;
68 import com.google.cloud.compute.v1.SetNodeTemplateNodeGroupRequest;
69 import com.google.cloud.compute.v1.SimulateMaintenanceEventNodeGroupRequest;
70 import com.google.cloud.compute.v1.TestIamPermissionsNodeGroupRequest;
71 import com.google.cloud.compute.v1.TestPermissionsResponse;
72 import com.google.common.collect.ImmutableList;
73 import com.google.common.collect.ImmutableMap;
74 import com.google.common.collect.ImmutableSet;
75 import com.google.common.collect.Lists;
76 import java.io.IOException;
77 import java.util.Collections;
78 import java.util.List;
79 import java.util.Map;
80 import javax.annotation.Generated;
81 import org.threeten.bp.Duration;
82 
83 // AUTO-GENERATED DOCUMENTATION AND CLASS.
84 /**
85  * Settings class to configure an instance of {@link NodeGroupsStub}.
86  *
87  * <p>The default instance has everything set to sensible defaults:
88  *
89  * <ul>
90  *   <li>The default service address (compute.googleapis.com) and default port (443) are used.
91  *   <li>Credentials are acquired automatically through Application Default Credentials.
92  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
93  * </ul>
94  *
95  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
96  * build() is called, the tree of builders is called to create the complete settings object.
97  *
98  * <p>For example, to set the total timeout of get to 30 seconds:
99  *
100  * <pre>{@code
101  * // This snippet has been automatically generated and should be regarded as a code template only.
102  * // It will require modifications to work:
103  * // - It may require correct/in-range values for request initialization.
104  * // - It may require specifying regional endpoints when creating the service client as shown in
105  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
106  * NodeGroupsStubSettings.Builder nodeGroupsSettingsBuilder = NodeGroupsStubSettings.newBuilder();
107  * nodeGroupsSettingsBuilder
108  *     .getSettings()
109  *     .setRetrySettings(
110  *         nodeGroupsSettingsBuilder
111  *             .getSettings()
112  *             .getRetrySettings()
113  *             .toBuilder()
114  *             .setTotalTimeout(Duration.ofSeconds(30))
115  *             .build());
116  * NodeGroupsStubSettings nodeGroupsSettings = nodeGroupsSettingsBuilder.build();
117  * }</pre>
118  */
119 @Generated("by gapic-generator-java")
120 public class NodeGroupsStubSettings extends StubSettings<NodeGroupsStubSettings> {
121   /** The default scopes of the service. */
122   private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES =
123       ImmutableList.<String>builder()
124           .add("https://www.googleapis.com/auth/compute")
125           .add("https://www.googleapis.com/auth/cloud-platform")
126           .build();
127 
128   private final UnaryCallSettings<AddNodesNodeGroupRequest, Operation> addNodesSettings;
129   private final OperationCallSettings<AddNodesNodeGroupRequest, Operation, Operation>
130       addNodesOperationSettings;
131   private final PagedCallSettings<
132           AggregatedListNodeGroupsRequest, NodeGroupAggregatedList, AggregatedListPagedResponse>
133       aggregatedListSettings;
134   private final UnaryCallSettings<DeleteNodeGroupRequest, Operation> deleteSettings;
135   private final OperationCallSettings<DeleteNodeGroupRequest, Operation, Operation>
136       deleteOperationSettings;
137   private final UnaryCallSettings<DeleteNodesNodeGroupRequest, Operation> deleteNodesSettings;
138   private final OperationCallSettings<DeleteNodesNodeGroupRequest, Operation, Operation>
139       deleteNodesOperationSettings;
140   private final UnaryCallSettings<GetNodeGroupRequest, NodeGroup> getSettings;
141   private final UnaryCallSettings<GetIamPolicyNodeGroupRequest, Policy> getIamPolicySettings;
142   private final UnaryCallSettings<InsertNodeGroupRequest, Operation> insertSettings;
143   private final OperationCallSettings<InsertNodeGroupRequest, Operation, Operation>
144       insertOperationSettings;
145   private final PagedCallSettings<ListNodeGroupsRequest, NodeGroupList, ListPagedResponse>
146       listSettings;
147   private final PagedCallSettings<
148           ListNodesNodeGroupsRequest, NodeGroupsListNodes, ListNodesPagedResponse>
149       listNodesSettings;
150   private final UnaryCallSettings<PatchNodeGroupRequest, Operation> patchSettings;
151   private final OperationCallSettings<PatchNodeGroupRequest, Operation, Operation>
152       patchOperationSettings;
153   private final UnaryCallSettings<SetIamPolicyNodeGroupRequest, Policy> setIamPolicySettings;
154   private final UnaryCallSettings<SetNodeTemplateNodeGroupRequest, Operation>
155       setNodeTemplateSettings;
156   private final OperationCallSettings<SetNodeTemplateNodeGroupRequest, Operation, Operation>
157       setNodeTemplateOperationSettings;
158   private final UnaryCallSettings<SimulateMaintenanceEventNodeGroupRequest, Operation>
159       simulateMaintenanceEventSettings;
160   private final OperationCallSettings<
161           SimulateMaintenanceEventNodeGroupRequest, Operation, Operation>
162       simulateMaintenanceEventOperationSettings;
163   private final UnaryCallSettings<TestIamPermissionsNodeGroupRequest, TestPermissionsResponse>
164       testIamPermissionsSettings;
165 
166   private static final PagedListDescriptor<
167           AggregatedListNodeGroupsRequest,
168           NodeGroupAggregatedList,
169           Map.Entry<String, NodeGroupsScopedList>>
170       AGGREGATED_LIST_PAGE_STR_DESC =
171           new PagedListDescriptor<
172               AggregatedListNodeGroupsRequest,
173               NodeGroupAggregatedList,
174               Map.Entry<String, NodeGroupsScopedList>>() {
175             @Override
176             public String emptyToken() {
177               return "";
178             }
179 
180             @Override
181             public AggregatedListNodeGroupsRequest injectToken(
182                 AggregatedListNodeGroupsRequest payload, String token) {
183               return AggregatedListNodeGroupsRequest.newBuilder(payload)
184                   .setPageToken(token)
185                   .build();
186             }
187 
188             @Override
189             public AggregatedListNodeGroupsRequest injectPageSize(
190                 AggregatedListNodeGroupsRequest payload, int pageSize) {
191               return AggregatedListNodeGroupsRequest.newBuilder(payload)
192                   .setMaxResults(pageSize)
193                   .build();
194             }
195 
196             @Override
197             public Integer extractPageSize(AggregatedListNodeGroupsRequest payload) {
198               return payload.getMaxResults();
199             }
200 
201             @Override
202             public String extractNextToken(NodeGroupAggregatedList payload) {
203               return payload.getNextPageToken();
204             }
205 
206             @Override
207             public Iterable<Map.Entry<String, NodeGroupsScopedList>> extractResources(
208                 NodeGroupAggregatedList payload) {
209               return payload.getItemsMap() == null
210                   ? Collections.<Map.Entry<String, NodeGroupsScopedList>>emptySet()
211                   : payload.getItemsMap().entrySet();
212             }
213           };
214 
215   private static final PagedListDescriptor<ListNodeGroupsRequest, NodeGroupList, NodeGroup>
216       LIST_PAGE_STR_DESC =
217           new PagedListDescriptor<ListNodeGroupsRequest, NodeGroupList, NodeGroup>() {
218             @Override
219             public String emptyToken() {
220               return "";
221             }
222 
223             @Override
224             public ListNodeGroupsRequest injectToken(ListNodeGroupsRequest payload, String token) {
225               return ListNodeGroupsRequest.newBuilder(payload).setPageToken(token).build();
226             }
227 
228             @Override
229             public ListNodeGroupsRequest injectPageSize(
230                 ListNodeGroupsRequest payload, int pageSize) {
231               return ListNodeGroupsRequest.newBuilder(payload).setMaxResults(pageSize).build();
232             }
233 
234             @Override
235             public Integer extractPageSize(ListNodeGroupsRequest payload) {
236               return payload.getMaxResults();
237             }
238 
239             @Override
240             public String extractNextToken(NodeGroupList payload) {
241               return payload.getNextPageToken();
242             }
243 
244             @Override
245             public Iterable<NodeGroup> extractResources(NodeGroupList payload) {
246               return payload.getItemsList() == null
247                   ? ImmutableList.<NodeGroup>of()
248                   : payload.getItemsList();
249             }
250           };
251 
252   private static final PagedListDescriptor<
253           ListNodesNodeGroupsRequest, NodeGroupsListNodes, NodeGroupNode>
254       LIST_NODES_PAGE_STR_DESC =
255           new PagedListDescriptor<
256               ListNodesNodeGroupsRequest, NodeGroupsListNodes, NodeGroupNode>() {
257             @Override
258             public String emptyToken() {
259               return "";
260             }
261 
262             @Override
263             public ListNodesNodeGroupsRequest injectToken(
264                 ListNodesNodeGroupsRequest payload, String token) {
265               return ListNodesNodeGroupsRequest.newBuilder(payload).setPageToken(token).build();
266             }
267 
268             @Override
269             public ListNodesNodeGroupsRequest injectPageSize(
270                 ListNodesNodeGroupsRequest payload, int pageSize) {
271               return ListNodesNodeGroupsRequest.newBuilder(payload).setMaxResults(pageSize).build();
272             }
273 
274             @Override
275             public Integer extractPageSize(ListNodesNodeGroupsRequest payload) {
276               return payload.getMaxResults();
277             }
278 
279             @Override
280             public String extractNextToken(NodeGroupsListNodes payload) {
281               return payload.getNextPageToken();
282             }
283 
284             @Override
285             public Iterable<NodeGroupNode> extractResources(NodeGroupsListNodes payload) {
286               return payload.getItemsList() == null
287                   ? ImmutableList.<NodeGroupNode>of()
288                   : payload.getItemsList();
289             }
290           };
291 
292   private static final PagedListResponseFactory<
293           AggregatedListNodeGroupsRequest, NodeGroupAggregatedList, AggregatedListPagedResponse>
294       AGGREGATED_LIST_PAGE_STR_FACT =
295           new PagedListResponseFactory<
296               AggregatedListNodeGroupsRequest,
297               NodeGroupAggregatedList,
298               AggregatedListPagedResponse>() {
299             @Override
300             public ApiFuture<AggregatedListPagedResponse> getFuturePagedResponse(
301                 UnaryCallable<AggregatedListNodeGroupsRequest, NodeGroupAggregatedList> callable,
302                 AggregatedListNodeGroupsRequest request,
303                 ApiCallContext context,
304                 ApiFuture<NodeGroupAggregatedList> futureResponse) {
305               PageContext<
306                       AggregatedListNodeGroupsRequest,
307                       NodeGroupAggregatedList,
308                       Map.Entry<String, NodeGroupsScopedList>>
309                   pageContext =
310                       PageContext.create(callable, AGGREGATED_LIST_PAGE_STR_DESC, request, context);
311               return AggregatedListPagedResponse.createAsync(pageContext, futureResponse);
312             }
313           };
314 
315   private static final PagedListResponseFactory<
316           ListNodeGroupsRequest, NodeGroupList, ListPagedResponse>
317       LIST_PAGE_STR_FACT =
318           new PagedListResponseFactory<ListNodeGroupsRequest, NodeGroupList, ListPagedResponse>() {
319             @Override
320             public ApiFuture<ListPagedResponse> getFuturePagedResponse(
321                 UnaryCallable<ListNodeGroupsRequest, NodeGroupList> callable,
322                 ListNodeGroupsRequest request,
323                 ApiCallContext context,
324                 ApiFuture<NodeGroupList> futureResponse) {
325               PageContext<ListNodeGroupsRequest, NodeGroupList, NodeGroup> pageContext =
326                   PageContext.create(callable, LIST_PAGE_STR_DESC, request, context);
327               return ListPagedResponse.createAsync(pageContext, futureResponse);
328             }
329           };
330 
331   private static final PagedListResponseFactory<
332           ListNodesNodeGroupsRequest, NodeGroupsListNodes, ListNodesPagedResponse>
333       LIST_NODES_PAGE_STR_FACT =
334           new PagedListResponseFactory<
335               ListNodesNodeGroupsRequest, NodeGroupsListNodes, ListNodesPagedResponse>() {
336             @Override
337             public ApiFuture<ListNodesPagedResponse> getFuturePagedResponse(
338                 UnaryCallable<ListNodesNodeGroupsRequest, NodeGroupsListNodes> callable,
339                 ListNodesNodeGroupsRequest request,
340                 ApiCallContext context,
341                 ApiFuture<NodeGroupsListNodes> futureResponse) {
342               PageContext<ListNodesNodeGroupsRequest, NodeGroupsListNodes, NodeGroupNode>
343                   pageContext =
344                       PageContext.create(callable, LIST_NODES_PAGE_STR_DESC, request, context);
345               return ListNodesPagedResponse.createAsync(pageContext, futureResponse);
346             }
347           };
348 
349   /** Returns the object with the settings used for calls to addNodes. */
addNodesSettings()350   public UnaryCallSettings<AddNodesNodeGroupRequest, Operation> addNodesSettings() {
351     return addNodesSettings;
352   }
353 
354   /** Returns the object with the settings used for calls to addNodes. */
355   public OperationCallSettings<AddNodesNodeGroupRequest, Operation, Operation>
addNodesOperationSettings()356       addNodesOperationSettings() {
357     return addNodesOperationSettings;
358   }
359 
360   /** Returns the object with the settings used for calls to aggregatedList. */
361   public PagedCallSettings<
362           AggregatedListNodeGroupsRequest, NodeGroupAggregatedList, AggregatedListPagedResponse>
aggregatedListSettings()363       aggregatedListSettings() {
364     return aggregatedListSettings;
365   }
366 
367   /** Returns the object with the settings used for calls to delete. */
deleteSettings()368   public UnaryCallSettings<DeleteNodeGroupRequest, Operation> deleteSettings() {
369     return deleteSettings;
370   }
371 
372   /** Returns the object with the settings used for calls to delete. */
373   public OperationCallSettings<DeleteNodeGroupRequest, Operation, Operation>
deleteOperationSettings()374       deleteOperationSettings() {
375     return deleteOperationSettings;
376   }
377 
378   /** Returns the object with the settings used for calls to deleteNodes. */
deleteNodesSettings()379   public UnaryCallSettings<DeleteNodesNodeGroupRequest, Operation> deleteNodesSettings() {
380     return deleteNodesSettings;
381   }
382 
383   /** Returns the object with the settings used for calls to deleteNodes. */
384   public OperationCallSettings<DeleteNodesNodeGroupRequest, Operation, Operation>
deleteNodesOperationSettings()385       deleteNodesOperationSettings() {
386     return deleteNodesOperationSettings;
387   }
388 
389   /** Returns the object with the settings used for calls to get. */
getSettings()390   public UnaryCallSettings<GetNodeGroupRequest, NodeGroup> getSettings() {
391     return getSettings;
392   }
393 
394   /** Returns the object with the settings used for calls to getIamPolicy. */
getIamPolicySettings()395   public UnaryCallSettings<GetIamPolicyNodeGroupRequest, Policy> getIamPolicySettings() {
396     return getIamPolicySettings;
397   }
398 
399   /** Returns the object with the settings used for calls to insert. */
insertSettings()400   public UnaryCallSettings<InsertNodeGroupRequest, Operation> insertSettings() {
401     return insertSettings;
402   }
403 
404   /** Returns the object with the settings used for calls to insert. */
405   public OperationCallSettings<InsertNodeGroupRequest, Operation, Operation>
insertOperationSettings()406       insertOperationSettings() {
407     return insertOperationSettings;
408   }
409 
410   /** Returns the object with the settings used for calls to list. */
listSettings()411   public PagedCallSettings<ListNodeGroupsRequest, NodeGroupList, ListPagedResponse> listSettings() {
412     return listSettings;
413   }
414 
415   /** Returns the object with the settings used for calls to listNodes. */
416   public PagedCallSettings<ListNodesNodeGroupsRequest, NodeGroupsListNodes, ListNodesPagedResponse>
listNodesSettings()417       listNodesSettings() {
418     return listNodesSettings;
419   }
420 
421   /** Returns the object with the settings used for calls to patch. */
patchSettings()422   public UnaryCallSettings<PatchNodeGroupRequest, Operation> patchSettings() {
423     return patchSettings;
424   }
425 
426   /** Returns the object with the settings used for calls to patch. */
427   public OperationCallSettings<PatchNodeGroupRequest, Operation, Operation>
patchOperationSettings()428       patchOperationSettings() {
429     return patchOperationSettings;
430   }
431 
432   /** Returns the object with the settings used for calls to setIamPolicy. */
setIamPolicySettings()433   public UnaryCallSettings<SetIamPolicyNodeGroupRequest, Policy> setIamPolicySettings() {
434     return setIamPolicySettings;
435   }
436 
437   /** Returns the object with the settings used for calls to setNodeTemplate. */
setNodeTemplateSettings()438   public UnaryCallSettings<SetNodeTemplateNodeGroupRequest, Operation> setNodeTemplateSettings() {
439     return setNodeTemplateSettings;
440   }
441 
442   /** Returns the object with the settings used for calls to setNodeTemplate. */
443   public OperationCallSettings<SetNodeTemplateNodeGroupRequest, Operation, Operation>
setNodeTemplateOperationSettings()444       setNodeTemplateOperationSettings() {
445     return setNodeTemplateOperationSettings;
446   }
447 
448   /** Returns the object with the settings used for calls to simulateMaintenanceEvent. */
449   public UnaryCallSettings<SimulateMaintenanceEventNodeGroupRequest, Operation>
simulateMaintenanceEventSettings()450       simulateMaintenanceEventSettings() {
451     return simulateMaintenanceEventSettings;
452   }
453 
454   /** Returns the object with the settings used for calls to simulateMaintenanceEvent. */
455   public OperationCallSettings<SimulateMaintenanceEventNodeGroupRequest, Operation, Operation>
simulateMaintenanceEventOperationSettings()456       simulateMaintenanceEventOperationSettings() {
457     return simulateMaintenanceEventOperationSettings;
458   }
459 
460   /** Returns the object with the settings used for calls to testIamPermissions. */
461   public UnaryCallSettings<TestIamPermissionsNodeGroupRequest, TestPermissionsResponse>
testIamPermissionsSettings()462       testIamPermissionsSettings() {
463     return testIamPermissionsSettings;
464   }
465 
createStub()466   public NodeGroupsStub createStub() throws IOException {
467     if (getTransportChannelProvider()
468         .getTransportName()
469         .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
470       return HttpJsonNodeGroupsStub.create(this);
471     }
472     throw new UnsupportedOperationException(
473         String.format(
474             "Transport not supported: %s", getTransportChannelProvider().getTransportName()));
475   }
476 
477   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()478   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
479     return InstantiatingExecutorProvider.newBuilder();
480   }
481 
482   /** Returns the default service endpoint. */
getDefaultEndpoint()483   public static String getDefaultEndpoint() {
484     return "compute.googleapis.com:443";
485   }
486 
487   /** Returns the default mTLS service endpoint. */
getDefaultMtlsEndpoint()488   public static String getDefaultMtlsEndpoint() {
489     return "compute.mtls.googleapis.com:443";
490   }
491 
492   /** Returns the default service scopes. */
getDefaultServiceScopes()493   public static List<String> getDefaultServiceScopes() {
494     return DEFAULT_SERVICE_SCOPES;
495   }
496 
497   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()498   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
499     return GoogleCredentialsProvider.newBuilder()
500         .setScopesToApply(DEFAULT_SERVICE_SCOPES)
501         .setUseJwtAccessWithScope(true);
502   }
503 
504   /** Returns a builder for the default ChannelProvider for this service. */
505   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()506       defaultHttpJsonTransportProviderBuilder() {
507     return InstantiatingHttpJsonChannelProvider.newBuilder();
508   }
509 
defaultTransportChannelProvider()510   public static TransportChannelProvider defaultTransportChannelProvider() {
511     return defaultHttpJsonTransportProviderBuilder().build();
512   }
513 
514   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()515   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
516     return ApiClientHeaderProvider.newBuilder()
517         .setGeneratedLibToken(
518             "gapic", GaxProperties.getLibraryVersion(NodeGroupsStubSettings.class))
519         .setTransportToken(
520             GaxHttpJsonProperties.getHttpJsonTokenName(),
521             GaxHttpJsonProperties.getHttpJsonVersion());
522   }
523 
524   /** Returns a new builder for this class. */
newBuilder()525   public static Builder newBuilder() {
526     return Builder.createDefault();
527   }
528 
529   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)530   public static Builder newBuilder(ClientContext clientContext) {
531     return new Builder(clientContext);
532   }
533 
534   /** Returns a builder containing all the values of this settings class. */
toBuilder()535   public Builder toBuilder() {
536     return new Builder(this);
537   }
538 
NodeGroupsStubSettings(Builder settingsBuilder)539   protected NodeGroupsStubSettings(Builder settingsBuilder) throws IOException {
540     super(settingsBuilder);
541 
542     addNodesSettings = settingsBuilder.addNodesSettings().build();
543     addNodesOperationSettings = settingsBuilder.addNodesOperationSettings().build();
544     aggregatedListSettings = settingsBuilder.aggregatedListSettings().build();
545     deleteSettings = settingsBuilder.deleteSettings().build();
546     deleteOperationSettings = settingsBuilder.deleteOperationSettings().build();
547     deleteNodesSettings = settingsBuilder.deleteNodesSettings().build();
548     deleteNodesOperationSettings = settingsBuilder.deleteNodesOperationSettings().build();
549     getSettings = settingsBuilder.getSettings().build();
550     getIamPolicySettings = settingsBuilder.getIamPolicySettings().build();
551     insertSettings = settingsBuilder.insertSettings().build();
552     insertOperationSettings = settingsBuilder.insertOperationSettings().build();
553     listSettings = settingsBuilder.listSettings().build();
554     listNodesSettings = settingsBuilder.listNodesSettings().build();
555     patchSettings = settingsBuilder.patchSettings().build();
556     patchOperationSettings = settingsBuilder.patchOperationSettings().build();
557     setIamPolicySettings = settingsBuilder.setIamPolicySettings().build();
558     setNodeTemplateSettings = settingsBuilder.setNodeTemplateSettings().build();
559     setNodeTemplateOperationSettings = settingsBuilder.setNodeTemplateOperationSettings().build();
560     simulateMaintenanceEventSettings = settingsBuilder.simulateMaintenanceEventSettings().build();
561     simulateMaintenanceEventOperationSettings =
562         settingsBuilder.simulateMaintenanceEventOperationSettings().build();
563     testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build();
564   }
565 
566   /** Builder for NodeGroupsStubSettings. */
567   public static class Builder extends StubSettings.Builder<NodeGroupsStubSettings, Builder> {
568     private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders;
569     private final UnaryCallSettings.Builder<AddNodesNodeGroupRequest, Operation> addNodesSettings;
570     private final OperationCallSettings.Builder<AddNodesNodeGroupRequest, Operation, Operation>
571         addNodesOperationSettings;
572     private final PagedCallSettings.Builder<
573             AggregatedListNodeGroupsRequest, NodeGroupAggregatedList, AggregatedListPagedResponse>
574         aggregatedListSettings;
575     private final UnaryCallSettings.Builder<DeleteNodeGroupRequest, Operation> deleteSettings;
576     private final OperationCallSettings.Builder<DeleteNodeGroupRequest, Operation, Operation>
577         deleteOperationSettings;
578     private final UnaryCallSettings.Builder<DeleteNodesNodeGroupRequest, Operation>
579         deleteNodesSettings;
580     private final OperationCallSettings.Builder<DeleteNodesNodeGroupRequest, Operation, Operation>
581         deleteNodesOperationSettings;
582     private final UnaryCallSettings.Builder<GetNodeGroupRequest, NodeGroup> getSettings;
583     private final UnaryCallSettings.Builder<GetIamPolicyNodeGroupRequest, Policy>
584         getIamPolicySettings;
585     private final UnaryCallSettings.Builder<InsertNodeGroupRequest, Operation> insertSettings;
586     private final OperationCallSettings.Builder<InsertNodeGroupRequest, Operation, Operation>
587         insertOperationSettings;
588     private final PagedCallSettings.Builder<ListNodeGroupsRequest, NodeGroupList, ListPagedResponse>
589         listSettings;
590     private final PagedCallSettings.Builder<
591             ListNodesNodeGroupsRequest, NodeGroupsListNodes, ListNodesPagedResponse>
592         listNodesSettings;
593     private final UnaryCallSettings.Builder<PatchNodeGroupRequest, Operation> patchSettings;
594     private final OperationCallSettings.Builder<PatchNodeGroupRequest, Operation, Operation>
595         patchOperationSettings;
596     private final UnaryCallSettings.Builder<SetIamPolicyNodeGroupRequest, Policy>
597         setIamPolicySettings;
598     private final UnaryCallSettings.Builder<SetNodeTemplateNodeGroupRequest, Operation>
599         setNodeTemplateSettings;
600     private final OperationCallSettings.Builder<
601             SetNodeTemplateNodeGroupRequest, Operation, Operation>
602         setNodeTemplateOperationSettings;
603     private final UnaryCallSettings.Builder<SimulateMaintenanceEventNodeGroupRequest, Operation>
604         simulateMaintenanceEventSettings;
605     private final OperationCallSettings.Builder<
606             SimulateMaintenanceEventNodeGroupRequest, Operation, Operation>
607         simulateMaintenanceEventOperationSettings;
608     private final UnaryCallSettings.Builder<
609             TestIamPermissionsNodeGroupRequest, TestPermissionsResponse>
610         testIamPermissionsSettings;
611     private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
612         RETRYABLE_CODE_DEFINITIONS;
613 
614     static {
615       ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
616           ImmutableMap.builder();
617       definitions.put(
618           "no_retry_1_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
619       definitions.put(
620           "retry_policy_0_codes",
621           ImmutableSet.copyOf(
622               Lists.<StatusCode.Code>newArrayList(
623                   StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
624       RETRYABLE_CODE_DEFINITIONS = definitions.build();
625     }
626 
627     private static final ImmutableMap<String, RetrySettings> RETRY_PARAM_DEFINITIONS;
628 
629     static {
630       ImmutableMap.Builder<String, RetrySettings> definitions = ImmutableMap.builder();
631       RetrySettings settings = null;
632       settings =
633           RetrySettings.newBuilder()
634               .setInitialRpcTimeout(Duration.ofMillis(600000L))
635               .setRpcTimeoutMultiplier(1.0)
636               .setMaxRpcTimeout(Duration.ofMillis(600000L))
637               .setTotalTimeout(Duration.ofMillis(600000L))
638               .build();
639       definitions.put("no_retry_1_params", settings);
640       settings =
641           RetrySettings.newBuilder()
642               .setInitialRetryDelay(Duration.ofMillis(100L))
643               .setRetryDelayMultiplier(1.3)
644               .setMaxRetryDelay(Duration.ofMillis(60000L))
645               .setInitialRpcTimeout(Duration.ofMillis(600000L))
646               .setRpcTimeoutMultiplier(1.0)
647               .setMaxRpcTimeout(Duration.ofMillis(600000L))
648               .setTotalTimeout(Duration.ofMillis(600000L))
649               .build();
650       definitions.put("retry_policy_0_params", settings);
651       RETRY_PARAM_DEFINITIONS = definitions.build();
652     }
653 
Builder()654     protected Builder() {
655       this(((ClientContext) null));
656     }
657 
Builder(ClientContext clientContext)658     protected Builder(ClientContext clientContext) {
659       super(clientContext);
660 
661       addNodesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
662       addNodesOperationSettings = OperationCallSettings.newBuilder();
663       aggregatedListSettings = PagedCallSettings.newBuilder(AGGREGATED_LIST_PAGE_STR_FACT);
664       deleteSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
665       deleteOperationSettings = OperationCallSettings.newBuilder();
666       deleteNodesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
667       deleteNodesOperationSettings = OperationCallSettings.newBuilder();
668       getSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
669       getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
670       insertSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
671       insertOperationSettings = OperationCallSettings.newBuilder();
672       listSettings = PagedCallSettings.newBuilder(LIST_PAGE_STR_FACT);
673       listNodesSettings = PagedCallSettings.newBuilder(LIST_NODES_PAGE_STR_FACT);
674       patchSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
675       patchOperationSettings = OperationCallSettings.newBuilder();
676       setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
677       setNodeTemplateSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
678       setNodeTemplateOperationSettings = OperationCallSettings.newBuilder();
679       simulateMaintenanceEventSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
680       simulateMaintenanceEventOperationSettings = OperationCallSettings.newBuilder();
681       testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
682 
683       unaryMethodSettingsBuilders =
684           ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
685               addNodesSettings,
686               aggregatedListSettings,
687               deleteSettings,
688               deleteNodesSettings,
689               getSettings,
690               getIamPolicySettings,
691               insertSettings,
692               listSettings,
693               listNodesSettings,
694               patchSettings,
695               setIamPolicySettings,
696               setNodeTemplateSettings,
697               simulateMaintenanceEventSettings,
698               testIamPermissionsSettings);
699       initDefaults(this);
700     }
701 
Builder(NodeGroupsStubSettings settings)702     protected Builder(NodeGroupsStubSettings settings) {
703       super(settings);
704 
705       addNodesSettings = settings.addNodesSettings.toBuilder();
706       addNodesOperationSettings = settings.addNodesOperationSettings.toBuilder();
707       aggregatedListSettings = settings.aggregatedListSettings.toBuilder();
708       deleteSettings = settings.deleteSettings.toBuilder();
709       deleteOperationSettings = settings.deleteOperationSettings.toBuilder();
710       deleteNodesSettings = settings.deleteNodesSettings.toBuilder();
711       deleteNodesOperationSettings = settings.deleteNodesOperationSettings.toBuilder();
712       getSettings = settings.getSettings.toBuilder();
713       getIamPolicySettings = settings.getIamPolicySettings.toBuilder();
714       insertSettings = settings.insertSettings.toBuilder();
715       insertOperationSettings = settings.insertOperationSettings.toBuilder();
716       listSettings = settings.listSettings.toBuilder();
717       listNodesSettings = settings.listNodesSettings.toBuilder();
718       patchSettings = settings.patchSettings.toBuilder();
719       patchOperationSettings = settings.patchOperationSettings.toBuilder();
720       setIamPolicySettings = settings.setIamPolicySettings.toBuilder();
721       setNodeTemplateSettings = settings.setNodeTemplateSettings.toBuilder();
722       setNodeTemplateOperationSettings = settings.setNodeTemplateOperationSettings.toBuilder();
723       simulateMaintenanceEventSettings = settings.simulateMaintenanceEventSettings.toBuilder();
724       simulateMaintenanceEventOperationSettings =
725           settings.simulateMaintenanceEventOperationSettings.toBuilder();
726       testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder();
727 
728       unaryMethodSettingsBuilders =
729           ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
730               addNodesSettings,
731               aggregatedListSettings,
732               deleteSettings,
733               deleteNodesSettings,
734               getSettings,
735               getIamPolicySettings,
736               insertSettings,
737               listSettings,
738               listNodesSettings,
739               patchSettings,
740               setIamPolicySettings,
741               setNodeTemplateSettings,
742               simulateMaintenanceEventSettings,
743               testIamPermissionsSettings);
744     }
745 
createDefault()746     private static Builder createDefault() {
747       Builder builder = new Builder(((ClientContext) null));
748 
749       builder.setTransportChannelProvider(defaultTransportChannelProvider());
750       builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
751       builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
752       builder.setEndpoint(getDefaultEndpoint());
753       builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
754       builder.setSwitchToMtlsEndpointAllowed(true);
755 
756       return initDefaults(builder);
757     }
758 
initDefaults(Builder builder)759     private static Builder initDefaults(Builder builder) {
760       builder
761           .addNodesSettings()
762           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
763           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
764 
765       builder
766           .aggregatedListSettings()
767           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
768           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
769 
770       builder
771           .deleteSettings()
772           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
773           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
774 
775       builder
776           .deleteNodesSettings()
777           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
778           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
779 
780       builder
781           .getSettings()
782           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
783           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
784 
785       builder
786           .getIamPolicySettings()
787           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
788           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
789 
790       builder
791           .insertSettings()
792           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
793           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
794 
795       builder
796           .listSettings()
797           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
798           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
799 
800       builder
801           .listNodesSettings()
802           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
803           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
804 
805       builder
806           .patchSettings()
807           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
808           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
809 
810       builder
811           .setIamPolicySettings()
812           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
813           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
814 
815       builder
816           .setNodeTemplateSettings()
817           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
818           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
819 
820       builder
821           .simulateMaintenanceEventSettings()
822           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
823           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
824 
825       builder
826           .testIamPermissionsSettings()
827           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
828           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
829 
830       builder
831           .addNodesOperationSettings()
832           .setInitialCallSettings(
833               UnaryCallSettings
834                   .<AddNodesNodeGroupRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
835                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
836                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
837                   .build())
838           .setResponseTransformer(
839               ProtoOperationTransformers.ResponseTransformer.create(Operation.class))
840           .setMetadataTransformer(
841               ProtoOperationTransformers.MetadataTransformer.create(Operation.class))
842           .setPollingAlgorithm(
843               OperationTimedPollAlgorithm.create(
844                   RetrySettings.newBuilder()
845                       .setInitialRetryDelay(Duration.ofMillis(500L))
846                       .setRetryDelayMultiplier(1.5)
847                       .setMaxRetryDelay(Duration.ofMillis(20000L))
848                       .setInitialRpcTimeout(Duration.ZERO)
849                       .setRpcTimeoutMultiplier(1.0)
850                       .setMaxRpcTimeout(Duration.ZERO)
851                       .setTotalTimeout(Duration.ofMillis(600000L))
852                       .build()));
853 
854       builder
855           .deleteOperationSettings()
856           .setInitialCallSettings(
857               UnaryCallSettings
858                   .<DeleteNodeGroupRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
859                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
860                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
861                   .build())
862           .setResponseTransformer(
863               ProtoOperationTransformers.ResponseTransformer.create(Operation.class))
864           .setMetadataTransformer(
865               ProtoOperationTransformers.MetadataTransformer.create(Operation.class))
866           .setPollingAlgorithm(
867               OperationTimedPollAlgorithm.create(
868                   RetrySettings.newBuilder()
869                       .setInitialRetryDelay(Duration.ofMillis(500L))
870                       .setRetryDelayMultiplier(1.5)
871                       .setMaxRetryDelay(Duration.ofMillis(20000L))
872                       .setInitialRpcTimeout(Duration.ZERO)
873                       .setRpcTimeoutMultiplier(1.0)
874                       .setMaxRpcTimeout(Duration.ZERO)
875                       .setTotalTimeout(Duration.ofMillis(600000L))
876                       .build()));
877 
878       builder
879           .deleteNodesOperationSettings()
880           .setInitialCallSettings(
881               UnaryCallSettings
882                   .<DeleteNodesNodeGroupRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
883                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
884                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
885                   .build())
886           .setResponseTransformer(
887               ProtoOperationTransformers.ResponseTransformer.create(Operation.class))
888           .setMetadataTransformer(
889               ProtoOperationTransformers.MetadataTransformer.create(Operation.class))
890           .setPollingAlgorithm(
891               OperationTimedPollAlgorithm.create(
892                   RetrySettings.newBuilder()
893                       .setInitialRetryDelay(Duration.ofMillis(500L))
894                       .setRetryDelayMultiplier(1.5)
895                       .setMaxRetryDelay(Duration.ofMillis(20000L))
896                       .setInitialRpcTimeout(Duration.ZERO)
897                       .setRpcTimeoutMultiplier(1.0)
898                       .setMaxRpcTimeout(Duration.ZERO)
899                       .setTotalTimeout(Duration.ofMillis(600000L))
900                       .build()));
901 
902       builder
903           .insertOperationSettings()
904           .setInitialCallSettings(
905               UnaryCallSettings
906                   .<InsertNodeGroupRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
907                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
908                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
909                   .build())
910           .setResponseTransformer(
911               ProtoOperationTransformers.ResponseTransformer.create(Operation.class))
912           .setMetadataTransformer(
913               ProtoOperationTransformers.MetadataTransformer.create(Operation.class))
914           .setPollingAlgorithm(
915               OperationTimedPollAlgorithm.create(
916                   RetrySettings.newBuilder()
917                       .setInitialRetryDelay(Duration.ofMillis(500L))
918                       .setRetryDelayMultiplier(1.5)
919                       .setMaxRetryDelay(Duration.ofMillis(20000L))
920                       .setInitialRpcTimeout(Duration.ZERO)
921                       .setRpcTimeoutMultiplier(1.0)
922                       .setMaxRpcTimeout(Duration.ZERO)
923                       .setTotalTimeout(Duration.ofMillis(600000L))
924                       .build()));
925 
926       builder
927           .patchOperationSettings()
928           .setInitialCallSettings(
929               UnaryCallSettings
930                   .<PatchNodeGroupRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
931                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
932                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
933                   .build())
934           .setResponseTransformer(
935               ProtoOperationTransformers.ResponseTransformer.create(Operation.class))
936           .setMetadataTransformer(
937               ProtoOperationTransformers.MetadataTransformer.create(Operation.class))
938           .setPollingAlgorithm(
939               OperationTimedPollAlgorithm.create(
940                   RetrySettings.newBuilder()
941                       .setInitialRetryDelay(Duration.ofMillis(500L))
942                       .setRetryDelayMultiplier(1.5)
943                       .setMaxRetryDelay(Duration.ofMillis(20000L))
944                       .setInitialRpcTimeout(Duration.ZERO)
945                       .setRpcTimeoutMultiplier(1.0)
946                       .setMaxRpcTimeout(Duration.ZERO)
947                       .setTotalTimeout(Duration.ofMillis(600000L))
948                       .build()));
949 
950       builder
951           .setNodeTemplateOperationSettings()
952           .setInitialCallSettings(
953               UnaryCallSettings
954                   .<SetNodeTemplateNodeGroupRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
955                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
956                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
957                   .build())
958           .setResponseTransformer(
959               ProtoOperationTransformers.ResponseTransformer.create(Operation.class))
960           .setMetadataTransformer(
961               ProtoOperationTransformers.MetadataTransformer.create(Operation.class))
962           .setPollingAlgorithm(
963               OperationTimedPollAlgorithm.create(
964                   RetrySettings.newBuilder()
965                       .setInitialRetryDelay(Duration.ofMillis(500L))
966                       .setRetryDelayMultiplier(1.5)
967                       .setMaxRetryDelay(Duration.ofMillis(20000L))
968                       .setInitialRpcTimeout(Duration.ZERO)
969                       .setRpcTimeoutMultiplier(1.0)
970                       .setMaxRpcTimeout(Duration.ZERO)
971                       .setTotalTimeout(Duration.ofMillis(600000L))
972                       .build()));
973 
974       builder
975           .simulateMaintenanceEventOperationSettings()
976           .setInitialCallSettings(
977               UnaryCallSettings
978                   .<SimulateMaintenanceEventNodeGroupRequest, OperationSnapshot>
979                       newUnaryCallSettingsBuilder()
980                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
981                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
982                   .build())
983           .setResponseTransformer(
984               ProtoOperationTransformers.ResponseTransformer.create(Operation.class))
985           .setMetadataTransformer(
986               ProtoOperationTransformers.MetadataTransformer.create(Operation.class))
987           .setPollingAlgorithm(
988               OperationTimedPollAlgorithm.create(
989                   RetrySettings.newBuilder()
990                       .setInitialRetryDelay(Duration.ofMillis(500L))
991                       .setRetryDelayMultiplier(1.5)
992                       .setMaxRetryDelay(Duration.ofMillis(20000L))
993                       .setInitialRpcTimeout(Duration.ZERO)
994                       .setRpcTimeoutMultiplier(1.0)
995                       .setMaxRpcTimeout(Duration.ZERO)
996                       .setTotalTimeout(Duration.ofMillis(600000L))
997                       .build()));
998 
999       return builder;
1000     }
1001 
1002     /**
1003      * Applies the given settings updater function to all of the unary API methods in this service.
1004      *
1005      * <p>Note: This method does not support applying settings to streaming methods.
1006      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)1007     public Builder applyToAllUnaryMethods(
1008         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
1009       super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
1010       return this;
1011     }
1012 
unaryMethodSettingsBuilders()1013     public ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders() {
1014       return unaryMethodSettingsBuilders;
1015     }
1016 
1017     /** Returns the builder for the settings used for calls to addNodes. */
addNodesSettings()1018     public UnaryCallSettings.Builder<AddNodesNodeGroupRequest, Operation> addNodesSettings() {
1019       return addNodesSettings;
1020     }
1021 
1022     /** Returns the builder for the settings used for calls to addNodes. */
1023     @BetaApi(
1024         "The surface for use by generated code is not stable yet and may change in the future.")
1025     public OperationCallSettings.Builder<AddNodesNodeGroupRequest, Operation, Operation>
addNodesOperationSettings()1026         addNodesOperationSettings() {
1027       return addNodesOperationSettings;
1028     }
1029 
1030     /** Returns the builder for the settings used for calls to aggregatedList. */
1031     public PagedCallSettings.Builder<
1032             AggregatedListNodeGroupsRequest, NodeGroupAggregatedList, AggregatedListPagedResponse>
aggregatedListSettings()1033         aggregatedListSettings() {
1034       return aggregatedListSettings;
1035     }
1036 
1037     /** Returns the builder for the settings used for calls to delete. */
deleteSettings()1038     public UnaryCallSettings.Builder<DeleteNodeGroupRequest, Operation> deleteSettings() {
1039       return deleteSettings;
1040     }
1041 
1042     /** Returns the builder for the settings used for calls to delete. */
1043     @BetaApi(
1044         "The surface for use by generated code is not stable yet and may change in the future.")
1045     public OperationCallSettings.Builder<DeleteNodeGroupRequest, Operation, Operation>
deleteOperationSettings()1046         deleteOperationSettings() {
1047       return deleteOperationSettings;
1048     }
1049 
1050     /** Returns the builder for the settings used for calls to deleteNodes. */
deleteNodesSettings()1051     public UnaryCallSettings.Builder<DeleteNodesNodeGroupRequest, Operation> deleteNodesSettings() {
1052       return deleteNodesSettings;
1053     }
1054 
1055     /** Returns the builder for the settings used for calls to deleteNodes. */
1056     @BetaApi(
1057         "The surface for use by generated code is not stable yet and may change in the future.")
1058     public OperationCallSettings.Builder<DeleteNodesNodeGroupRequest, Operation, Operation>
deleteNodesOperationSettings()1059         deleteNodesOperationSettings() {
1060       return deleteNodesOperationSettings;
1061     }
1062 
1063     /** Returns the builder for the settings used for calls to get. */
getSettings()1064     public UnaryCallSettings.Builder<GetNodeGroupRequest, NodeGroup> getSettings() {
1065       return getSettings;
1066     }
1067 
1068     /** Returns the builder for the settings used for calls to getIamPolicy. */
getIamPolicySettings()1069     public UnaryCallSettings.Builder<GetIamPolicyNodeGroupRequest, Policy> getIamPolicySettings() {
1070       return getIamPolicySettings;
1071     }
1072 
1073     /** Returns the builder for the settings used for calls to insert. */
insertSettings()1074     public UnaryCallSettings.Builder<InsertNodeGroupRequest, Operation> insertSettings() {
1075       return insertSettings;
1076     }
1077 
1078     /** Returns the builder for the settings used for calls to insert. */
1079     @BetaApi(
1080         "The surface for use by generated code is not stable yet and may change in the future.")
1081     public OperationCallSettings.Builder<InsertNodeGroupRequest, Operation, Operation>
insertOperationSettings()1082         insertOperationSettings() {
1083       return insertOperationSettings;
1084     }
1085 
1086     /** Returns the builder for the settings used for calls to list. */
1087     public PagedCallSettings.Builder<ListNodeGroupsRequest, NodeGroupList, ListPagedResponse>
listSettings()1088         listSettings() {
1089       return listSettings;
1090     }
1091 
1092     /** Returns the builder for the settings used for calls to listNodes. */
1093     public PagedCallSettings.Builder<
1094             ListNodesNodeGroupsRequest, NodeGroupsListNodes, ListNodesPagedResponse>
listNodesSettings()1095         listNodesSettings() {
1096       return listNodesSettings;
1097     }
1098 
1099     /** Returns the builder for the settings used for calls to patch. */
patchSettings()1100     public UnaryCallSettings.Builder<PatchNodeGroupRequest, Operation> patchSettings() {
1101       return patchSettings;
1102     }
1103 
1104     /** Returns the builder for the settings used for calls to patch. */
1105     @BetaApi(
1106         "The surface for use by generated code is not stable yet and may change in the future.")
1107     public OperationCallSettings.Builder<PatchNodeGroupRequest, Operation, Operation>
patchOperationSettings()1108         patchOperationSettings() {
1109       return patchOperationSettings;
1110     }
1111 
1112     /** Returns the builder for the settings used for calls to setIamPolicy. */
setIamPolicySettings()1113     public UnaryCallSettings.Builder<SetIamPolicyNodeGroupRequest, Policy> setIamPolicySettings() {
1114       return setIamPolicySettings;
1115     }
1116 
1117     /** Returns the builder for the settings used for calls to setNodeTemplate. */
1118     public UnaryCallSettings.Builder<SetNodeTemplateNodeGroupRequest, Operation>
setNodeTemplateSettings()1119         setNodeTemplateSettings() {
1120       return setNodeTemplateSettings;
1121     }
1122 
1123     /** Returns the builder for the settings used for calls to setNodeTemplate. */
1124     @BetaApi(
1125         "The surface for use by generated code is not stable yet and may change in the future.")
1126     public OperationCallSettings.Builder<SetNodeTemplateNodeGroupRequest, Operation, Operation>
setNodeTemplateOperationSettings()1127         setNodeTemplateOperationSettings() {
1128       return setNodeTemplateOperationSettings;
1129     }
1130 
1131     /** Returns the builder for the settings used for calls to simulateMaintenanceEvent. */
1132     public UnaryCallSettings.Builder<SimulateMaintenanceEventNodeGroupRequest, Operation>
simulateMaintenanceEventSettings()1133         simulateMaintenanceEventSettings() {
1134       return simulateMaintenanceEventSettings;
1135     }
1136 
1137     /** Returns the builder for the settings used for calls to simulateMaintenanceEvent. */
1138     @BetaApi(
1139         "The surface for use by generated code is not stable yet and may change in the future.")
1140     public OperationCallSettings.Builder<
1141             SimulateMaintenanceEventNodeGroupRequest, Operation, Operation>
simulateMaintenanceEventOperationSettings()1142         simulateMaintenanceEventOperationSettings() {
1143       return simulateMaintenanceEventOperationSettings;
1144     }
1145 
1146     /** Returns the builder for the settings used for calls to testIamPermissions. */
1147     public UnaryCallSettings.Builder<TestIamPermissionsNodeGroupRequest, TestPermissionsResponse>
testIamPermissionsSettings()1148         testIamPermissionsSettings() {
1149       return testIamPermissionsSettings;
1150     }
1151 
1152     @Override
build()1153     public NodeGroupsStubSettings build() throws IOException {
1154       return new NodeGroupsStubSettings(this);
1155     }
1156   }
1157 }
1158