• 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.asset.v1.stub;
18 
19 import static com.google.cloud.asset.v1.AssetServiceClient.AnalyzeOrgPoliciesPagedResponse;
20 import static com.google.cloud.asset.v1.AssetServiceClient.AnalyzeOrgPolicyGovernedAssetsPagedResponse;
21 import static com.google.cloud.asset.v1.AssetServiceClient.AnalyzeOrgPolicyGovernedContainersPagedResponse;
22 import static com.google.cloud.asset.v1.AssetServiceClient.ListAssetsPagedResponse;
23 import static com.google.cloud.asset.v1.AssetServiceClient.ListSavedQueriesPagedResponse;
24 import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllIamPoliciesPagedResponse;
25 import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllResourcesPagedResponse;
26 
27 import com.google.api.core.ApiFunction;
28 import com.google.api.core.ApiFuture;
29 import com.google.api.core.BetaApi;
30 import com.google.api.gax.core.GaxProperties;
31 import com.google.api.gax.core.GoogleCredentialsProvider;
32 import com.google.api.gax.core.InstantiatingExecutorProvider;
33 import com.google.api.gax.grpc.GaxGrpcProperties;
34 import com.google.api.gax.grpc.GrpcTransportChannel;
35 import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
36 import com.google.api.gax.grpc.ProtoOperationTransformers;
37 import com.google.api.gax.httpjson.GaxHttpJsonProperties;
38 import com.google.api.gax.httpjson.HttpJsonTransportChannel;
39 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
40 import com.google.api.gax.longrunning.OperationSnapshot;
41 import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
42 import com.google.api.gax.retrying.RetrySettings;
43 import com.google.api.gax.rpc.ApiCallContext;
44 import com.google.api.gax.rpc.ApiClientHeaderProvider;
45 import com.google.api.gax.rpc.ClientContext;
46 import com.google.api.gax.rpc.OperationCallSettings;
47 import com.google.api.gax.rpc.PageContext;
48 import com.google.api.gax.rpc.PagedCallSettings;
49 import com.google.api.gax.rpc.PagedListDescriptor;
50 import com.google.api.gax.rpc.PagedListResponseFactory;
51 import com.google.api.gax.rpc.StatusCode;
52 import com.google.api.gax.rpc.StubSettings;
53 import com.google.api.gax.rpc.TransportChannelProvider;
54 import com.google.api.gax.rpc.UnaryCallSettings;
55 import com.google.api.gax.rpc.UnaryCallable;
56 import com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningMetadata;
57 import com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningRequest;
58 import com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse;
59 import com.google.cloud.asset.v1.AnalyzeIamPolicyRequest;
60 import com.google.cloud.asset.v1.AnalyzeIamPolicyResponse;
61 import com.google.cloud.asset.v1.AnalyzeMoveRequest;
62 import com.google.cloud.asset.v1.AnalyzeMoveResponse;
63 import com.google.cloud.asset.v1.AnalyzeOrgPoliciesRequest;
64 import com.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse;
65 import com.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest;
66 import com.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse;
67 import com.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersRequest;
68 import com.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse;
69 import com.google.cloud.asset.v1.Asset;
70 import com.google.cloud.asset.v1.BatchGetAssetsHistoryRequest;
71 import com.google.cloud.asset.v1.BatchGetAssetsHistoryResponse;
72 import com.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest;
73 import com.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse;
74 import com.google.cloud.asset.v1.CreateFeedRequest;
75 import com.google.cloud.asset.v1.CreateSavedQueryRequest;
76 import com.google.cloud.asset.v1.DeleteFeedRequest;
77 import com.google.cloud.asset.v1.DeleteSavedQueryRequest;
78 import com.google.cloud.asset.v1.ExportAssetsRequest;
79 import com.google.cloud.asset.v1.ExportAssetsResponse;
80 import com.google.cloud.asset.v1.Feed;
81 import com.google.cloud.asset.v1.GetFeedRequest;
82 import com.google.cloud.asset.v1.GetSavedQueryRequest;
83 import com.google.cloud.asset.v1.IamPolicySearchResult;
84 import com.google.cloud.asset.v1.ListAssetsRequest;
85 import com.google.cloud.asset.v1.ListAssetsResponse;
86 import com.google.cloud.asset.v1.ListFeedsRequest;
87 import com.google.cloud.asset.v1.ListFeedsResponse;
88 import com.google.cloud.asset.v1.ListSavedQueriesRequest;
89 import com.google.cloud.asset.v1.ListSavedQueriesResponse;
90 import com.google.cloud.asset.v1.QueryAssetsRequest;
91 import com.google.cloud.asset.v1.QueryAssetsResponse;
92 import com.google.cloud.asset.v1.ResourceSearchResult;
93 import com.google.cloud.asset.v1.SavedQuery;
94 import com.google.cloud.asset.v1.SearchAllIamPoliciesRequest;
95 import com.google.cloud.asset.v1.SearchAllIamPoliciesResponse;
96 import com.google.cloud.asset.v1.SearchAllResourcesRequest;
97 import com.google.cloud.asset.v1.SearchAllResourcesResponse;
98 import com.google.cloud.asset.v1.UpdateFeedRequest;
99 import com.google.cloud.asset.v1.UpdateSavedQueryRequest;
100 import com.google.common.collect.ImmutableList;
101 import com.google.common.collect.ImmutableMap;
102 import com.google.common.collect.ImmutableSet;
103 import com.google.common.collect.Lists;
104 import com.google.longrunning.Operation;
105 import com.google.protobuf.Empty;
106 import java.io.IOException;
107 import java.util.List;
108 import javax.annotation.Generated;
109 import org.threeten.bp.Duration;
110 
111 // AUTO-GENERATED DOCUMENTATION AND CLASS.
112 /**
113  * Settings class to configure an instance of {@link AssetServiceStub}.
114  *
115  * <p>The default instance has everything set to sensible defaults:
116  *
117  * <ul>
118  *   <li>The default service address (cloudasset.googleapis.com) and default port (443) are used.
119  *   <li>Credentials are acquired automatically through Application Default Credentials.
120  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
121  * </ul>
122  *
123  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
124  * build() is called, the tree of builders is called to create the complete settings object.
125  *
126  * <p>For example, to set the total timeout of batchGetAssetsHistory to 30 seconds:
127  *
128  * <pre>{@code
129  * // This snippet has been automatically generated and should be regarded as a code template only.
130  * // It will require modifications to work:
131  * // - It may require correct/in-range values for request initialization.
132  * // - It may require specifying regional endpoints when creating the service client as shown in
133  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
134  * AssetServiceStubSettings.Builder assetServiceSettingsBuilder =
135  *     AssetServiceStubSettings.newBuilder();
136  * assetServiceSettingsBuilder
137  *     .batchGetAssetsHistorySettings()
138  *     .setRetrySettings(
139  *         assetServiceSettingsBuilder
140  *             .batchGetAssetsHistorySettings()
141  *             .getRetrySettings()
142  *             .toBuilder()
143  *             .setTotalTimeout(Duration.ofSeconds(30))
144  *             .build());
145  * AssetServiceStubSettings assetServiceSettings = assetServiceSettingsBuilder.build();
146  * }</pre>
147  */
148 @Generated("by gapic-generator-java")
149 public class AssetServiceStubSettings extends StubSettings<AssetServiceStubSettings> {
150   /** The default scopes of the service. */
151   private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES =
152       ImmutableList.<String>builder().add("https://www.googleapis.com/auth/cloud-platform").build();
153 
154   private final UnaryCallSettings<ExportAssetsRequest, Operation> exportAssetsSettings;
155   private final OperationCallSettings<
156           ExportAssetsRequest, ExportAssetsResponse, ExportAssetsRequest>
157       exportAssetsOperationSettings;
158   private final PagedCallSettings<ListAssetsRequest, ListAssetsResponse, ListAssetsPagedResponse>
159       listAssetsSettings;
160   private final UnaryCallSettings<BatchGetAssetsHistoryRequest, BatchGetAssetsHistoryResponse>
161       batchGetAssetsHistorySettings;
162   private final UnaryCallSettings<CreateFeedRequest, Feed> createFeedSettings;
163   private final UnaryCallSettings<GetFeedRequest, Feed> getFeedSettings;
164   private final UnaryCallSettings<ListFeedsRequest, ListFeedsResponse> listFeedsSettings;
165   private final UnaryCallSettings<UpdateFeedRequest, Feed> updateFeedSettings;
166   private final UnaryCallSettings<DeleteFeedRequest, Empty> deleteFeedSettings;
167   private final PagedCallSettings<
168           SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse>
169       searchAllResourcesSettings;
170   private final PagedCallSettings<
171           SearchAllIamPoliciesRequest,
172           SearchAllIamPoliciesResponse,
173           SearchAllIamPoliciesPagedResponse>
174       searchAllIamPoliciesSettings;
175   private final UnaryCallSettings<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
176       analyzeIamPolicySettings;
177   private final UnaryCallSettings<AnalyzeIamPolicyLongrunningRequest, Operation>
178       analyzeIamPolicyLongrunningSettings;
179   private final OperationCallSettings<
180           AnalyzeIamPolicyLongrunningRequest,
181           AnalyzeIamPolicyLongrunningResponse,
182           AnalyzeIamPolicyLongrunningMetadata>
183       analyzeIamPolicyLongrunningOperationSettings;
184   private final UnaryCallSettings<AnalyzeMoveRequest, AnalyzeMoveResponse> analyzeMoveSettings;
185   private final UnaryCallSettings<QueryAssetsRequest, QueryAssetsResponse> queryAssetsSettings;
186   private final UnaryCallSettings<CreateSavedQueryRequest, SavedQuery> createSavedQuerySettings;
187   private final UnaryCallSettings<GetSavedQueryRequest, SavedQuery> getSavedQuerySettings;
188   private final PagedCallSettings<
189           ListSavedQueriesRequest, ListSavedQueriesResponse, ListSavedQueriesPagedResponse>
190       listSavedQueriesSettings;
191   private final UnaryCallSettings<UpdateSavedQueryRequest, SavedQuery> updateSavedQuerySettings;
192   private final UnaryCallSettings<DeleteSavedQueryRequest, Empty> deleteSavedQuerySettings;
193   private final UnaryCallSettings<
194           BatchGetEffectiveIamPoliciesRequest, BatchGetEffectiveIamPoliciesResponse>
195       batchGetEffectiveIamPoliciesSettings;
196   private final PagedCallSettings<
197           AnalyzeOrgPoliciesRequest, AnalyzeOrgPoliciesResponse, AnalyzeOrgPoliciesPagedResponse>
198       analyzeOrgPoliciesSettings;
199   private final PagedCallSettings<
200           AnalyzeOrgPolicyGovernedContainersRequest,
201           AnalyzeOrgPolicyGovernedContainersResponse,
202           AnalyzeOrgPolicyGovernedContainersPagedResponse>
203       analyzeOrgPolicyGovernedContainersSettings;
204   private final PagedCallSettings<
205           AnalyzeOrgPolicyGovernedAssetsRequest,
206           AnalyzeOrgPolicyGovernedAssetsResponse,
207           AnalyzeOrgPolicyGovernedAssetsPagedResponse>
208       analyzeOrgPolicyGovernedAssetsSettings;
209 
210   private static final PagedListDescriptor<ListAssetsRequest, ListAssetsResponse, Asset>
211       LIST_ASSETS_PAGE_STR_DESC =
212           new PagedListDescriptor<ListAssetsRequest, ListAssetsResponse, Asset>() {
213             @Override
214             public String emptyToken() {
215               return "";
216             }
217 
218             @Override
219             public ListAssetsRequest injectToken(ListAssetsRequest payload, String token) {
220               return ListAssetsRequest.newBuilder(payload).setPageToken(token).build();
221             }
222 
223             @Override
224             public ListAssetsRequest injectPageSize(ListAssetsRequest payload, int pageSize) {
225               return ListAssetsRequest.newBuilder(payload).setPageSize(pageSize).build();
226             }
227 
228             @Override
229             public Integer extractPageSize(ListAssetsRequest payload) {
230               return payload.getPageSize();
231             }
232 
233             @Override
234             public String extractNextToken(ListAssetsResponse payload) {
235               return payload.getNextPageToken();
236             }
237 
238             @Override
239             public Iterable<Asset> extractResources(ListAssetsResponse payload) {
240               return payload.getAssetsList() == null
241                   ? ImmutableList.<Asset>of()
242                   : payload.getAssetsList();
243             }
244           };
245 
246   private static final PagedListDescriptor<
247           SearchAllResourcesRequest, SearchAllResourcesResponse, ResourceSearchResult>
248       SEARCH_ALL_RESOURCES_PAGE_STR_DESC =
249           new PagedListDescriptor<
250               SearchAllResourcesRequest, SearchAllResourcesResponse, ResourceSearchResult>() {
251             @Override
252             public String emptyToken() {
253               return "";
254             }
255 
256             @Override
257             public SearchAllResourcesRequest injectToken(
258                 SearchAllResourcesRequest payload, String token) {
259               return SearchAllResourcesRequest.newBuilder(payload).setPageToken(token).build();
260             }
261 
262             @Override
263             public SearchAllResourcesRequest injectPageSize(
264                 SearchAllResourcesRequest payload, int pageSize) {
265               return SearchAllResourcesRequest.newBuilder(payload).setPageSize(pageSize).build();
266             }
267 
268             @Override
269             public Integer extractPageSize(SearchAllResourcesRequest payload) {
270               return payload.getPageSize();
271             }
272 
273             @Override
274             public String extractNextToken(SearchAllResourcesResponse payload) {
275               return payload.getNextPageToken();
276             }
277 
278             @Override
279             public Iterable<ResourceSearchResult> extractResources(
280                 SearchAllResourcesResponse payload) {
281               return payload.getResultsList() == null
282                   ? ImmutableList.<ResourceSearchResult>of()
283                   : payload.getResultsList();
284             }
285           };
286 
287   private static final PagedListDescriptor<
288           SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse, IamPolicySearchResult>
289       SEARCH_ALL_IAM_POLICIES_PAGE_STR_DESC =
290           new PagedListDescriptor<
291               SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse, IamPolicySearchResult>() {
292             @Override
293             public String emptyToken() {
294               return "";
295             }
296 
297             @Override
298             public SearchAllIamPoliciesRequest injectToken(
299                 SearchAllIamPoliciesRequest payload, String token) {
300               return SearchAllIamPoliciesRequest.newBuilder(payload).setPageToken(token).build();
301             }
302 
303             @Override
304             public SearchAllIamPoliciesRequest injectPageSize(
305                 SearchAllIamPoliciesRequest payload, int pageSize) {
306               return SearchAllIamPoliciesRequest.newBuilder(payload).setPageSize(pageSize).build();
307             }
308 
309             @Override
310             public Integer extractPageSize(SearchAllIamPoliciesRequest payload) {
311               return payload.getPageSize();
312             }
313 
314             @Override
315             public String extractNextToken(SearchAllIamPoliciesResponse payload) {
316               return payload.getNextPageToken();
317             }
318 
319             @Override
320             public Iterable<IamPolicySearchResult> extractResources(
321                 SearchAllIamPoliciesResponse payload) {
322               return payload.getResultsList() == null
323                   ? ImmutableList.<IamPolicySearchResult>of()
324                   : payload.getResultsList();
325             }
326           };
327 
328   private static final PagedListDescriptor<
329           ListSavedQueriesRequest, ListSavedQueriesResponse, SavedQuery>
330       LIST_SAVED_QUERIES_PAGE_STR_DESC =
331           new PagedListDescriptor<ListSavedQueriesRequest, ListSavedQueriesResponse, SavedQuery>() {
332             @Override
333             public String emptyToken() {
334               return "";
335             }
336 
337             @Override
338             public ListSavedQueriesRequest injectToken(
339                 ListSavedQueriesRequest payload, String token) {
340               return ListSavedQueriesRequest.newBuilder(payload).setPageToken(token).build();
341             }
342 
343             @Override
344             public ListSavedQueriesRequest injectPageSize(
345                 ListSavedQueriesRequest payload, int pageSize) {
346               return ListSavedQueriesRequest.newBuilder(payload).setPageSize(pageSize).build();
347             }
348 
349             @Override
350             public Integer extractPageSize(ListSavedQueriesRequest payload) {
351               return payload.getPageSize();
352             }
353 
354             @Override
355             public String extractNextToken(ListSavedQueriesResponse payload) {
356               return payload.getNextPageToken();
357             }
358 
359             @Override
360             public Iterable<SavedQuery> extractResources(ListSavedQueriesResponse payload) {
361               return payload.getSavedQueriesList() == null
362                   ? ImmutableList.<SavedQuery>of()
363                   : payload.getSavedQueriesList();
364             }
365           };
366 
367   private static final PagedListDescriptor<
368           AnalyzeOrgPoliciesRequest,
369           AnalyzeOrgPoliciesResponse,
370           AnalyzeOrgPoliciesResponse.OrgPolicyResult>
371       ANALYZE_ORG_POLICIES_PAGE_STR_DESC =
372           new PagedListDescriptor<
373               AnalyzeOrgPoliciesRequest,
374               AnalyzeOrgPoliciesResponse,
375               AnalyzeOrgPoliciesResponse.OrgPolicyResult>() {
376             @Override
377             public String emptyToken() {
378               return "";
379             }
380 
381             @Override
382             public AnalyzeOrgPoliciesRequest injectToken(
383                 AnalyzeOrgPoliciesRequest payload, String token) {
384               return AnalyzeOrgPoliciesRequest.newBuilder(payload).setPageToken(token).build();
385             }
386 
387             @Override
388             public AnalyzeOrgPoliciesRequest injectPageSize(
389                 AnalyzeOrgPoliciesRequest payload, int pageSize) {
390               return AnalyzeOrgPoliciesRequest.newBuilder(payload).setPageSize(pageSize).build();
391             }
392 
393             @Override
394             public Integer extractPageSize(AnalyzeOrgPoliciesRequest payload) {
395               return payload.getPageSize();
396             }
397 
398             @Override
399             public String extractNextToken(AnalyzeOrgPoliciesResponse payload) {
400               return payload.getNextPageToken();
401             }
402 
403             @Override
404             public Iterable<AnalyzeOrgPoliciesResponse.OrgPolicyResult> extractResources(
405                 AnalyzeOrgPoliciesResponse payload) {
406               return payload.getOrgPolicyResultsList() == null
407                   ? ImmutableList.<AnalyzeOrgPoliciesResponse.OrgPolicyResult>of()
408                   : payload.getOrgPolicyResultsList();
409             }
410           };
411 
412   private static final PagedListDescriptor<
413           AnalyzeOrgPolicyGovernedContainersRequest,
414           AnalyzeOrgPolicyGovernedContainersResponse,
415           AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer>
416       ANALYZE_ORG_POLICY_GOVERNED_CONTAINERS_PAGE_STR_DESC =
417           new PagedListDescriptor<
418               AnalyzeOrgPolicyGovernedContainersRequest,
419               AnalyzeOrgPolicyGovernedContainersResponse,
420               AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer>() {
421             @Override
422             public String emptyToken() {
423               return "";
424             }
425 
426             @Override
427             public AnalyzeOrgPolicyGovernedContainersRequest injectToken(
428                 AnalyzeOrgPolicyGovernedContainersRequest payload, String token) {
429               return AnalyzeOrgPolicyGovernedContainersRequest.newBuilder(payload)
430                   .setPageToken(token)
431                   .build();
432             }
433 
434             @Override
435             public AnalyzeOrgPolicyGovernedContainersRequest injectPageSize(
436                 AnalyzeOrgPolicyGovernedContainersRequest payload, int pageSize) {
437               return AnalyzeOrgPolicyGovernedContainersRequest.newBuilder(payload)
438                   .setPageSize(pageSize)
439                   .build();
440             }
441 
442             @Override
443             public Integer extractPageSize(AnalyzeOrgPolicyGovernedContainersRequest payload) {
444               return payload.getPageSize();
445             }
446 
447             @Override
448             public String extractNextToken(AnalyzeOrgPolicyGovernedContainersResponse payload) {
449               return payload.getNextPageToken();
450             }
451 
452             @Override
453             public Iterable<AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer>
454                 extractResources(AnalyzeOrgPolicyGovernedContainersResponse payload) {
455               return payload.getGovernedContainersList() == null
456                   ? ImmutableList.<AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer>of()
457                   : payload.getGovernedContainersList();
458             }
459           };
460 
461   private static final PagedListDescriptor<
462           AnalyzeOrgPolicyGovernedAssetsRequest,
463           AnalyzeOrgPolicyGovernedAssetsResponse,
464           AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset>
465       ANALYZE_ORG_POLICY_GOVERNED_ASSETS_PAGE_STR_DESC =
466           new PagedListDescriptor<
467               AnalyzeOrgPolicyGovernedAssetsRequest,
468               AnalyzeOrgPolicyGovernedAssetsResponse,
469               AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset>() {
470             @Override
471             public String emptyToken() {
472               return "";
473             }
474 
475             @Override
476             public AnalyzeOrgPolicyGovernedAssetsRequest injectToken(
477                 AnalyzeOrgPolicyGovernedAssetsRequest payload, String token) {
478               return AnalyzeOrgPolicyGovernedAssetsRequest.newBuilder(payload)
479                   .setPageToken(token)
480                   .build();
481             }
482 
483             @Override
484             public AnalyzeOrgPolicyGovernedAssetsRequest injectPageSize(
485                 AnalyzeOrgPolicyGovernedAssetsRequest payload, int pageSize) {
486               return AnalyzeOrgPolicyGovernedAssetsRequest.newBuilder(payload)
487                   .setPageSize(pageSize)
488                   .build();
489             }
490 
491             @Override
492             public Integer extractPageSize(AnalyzeOrgPolicyGovernedAssetsRequest payload) {
493               return payload.getPageSize();
494             }
495 
496             @Override
497             public String extractNextToken(AnalyzeOrgPolicyGovernedAssetsResponse payload) {
498               return payload.getNextPageToken();
499             }
500 
501             @Override
502             public Iterable<AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset> extractResources(
503                 AnalyzeOrgPolicyGovernedAssetsResponse payload) {
504               return payload.getGovernedAssetsList() == null
505                   ? ImmutableList.<AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset>of()
506                   : payload.getGovernedAssetsList();
507             }
508           };
509 
510   private static final PagedListResponseFactory<
511           ListAssetsRequest, ListAssetsResponse, ListAssetsPagedResponse>
512       LIST_ASSETS_PAGE_STR_FACT =
513           new PagedListResponseFactory<
514               ListAssetsRequest, ListAssetsResponse, ListAssetsPagedResponse>() {
515             @Override
516             public ApiFuture<ListAssetsPagedResponse> getFuturePagedResponse(
517                 UnaryCallable<ListAssetsRequest, ListAssetsResponse> callable,
518                 ListAssetsRequest request,
519                 ApiCallContext context,
520                 ApiFuture<ListAssetsResponse> futureResponse) {
521               PageContext<ListAssetsRequest, ListAssetsResponse, Asset> pageContext =
522                   PageContext.create(callable, LIST_ASSETS_PAGE_STR_DESC, request, context);
523               return ListAssetsPagedResponse.createAsync(pageContext, futureResponse);
524             }
525           };
526 
527   private static final PagedListResponseFactory<
528           SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse>
529       SEARCH_ALL_RESOURCES_PAGE_STR_FACT =
530           new PagedListResponseFactory<
531               SearchAllResourcesRequest,
532               SearchAllResourcesResponse,
533               SearchAllResourcesPagedResponse>() {
534             @Override
535             public ApiFuture<SearchAllResourcesPagedResponse> getFuturePagedResponse(
536                 UnaryCallable<SearchAllResourcesRequest, SearchAllResourcesResponse> callable,
537                 SearchAllResourcesRequest request,
538                 ApiCallContext context,
539                 ApiFuture<SearchAllResourcesResponse> futureResponse) {
540               PageContext<
541                       SearchAllResourcesRequest, SearchAllResourcesResponse, ResourceSearchResult>
542                   pageContext =
543                       PageContext.create(
544                           callable, SEARCH_ALL_RESOURCES_PAGE_STR_DESC, request, context);
545               return SearchAllResourcesPagedResponse.createAsync(pageContext, futureResponse);
546             }
547           };
548 
549   private static final PagedListResponseFactory<
550           SearchAllIamPoliciesRequest,
551           SearchAllIamPoliciesResponse,
552           SearchAllIamPoliciesPagedResponse>
553       SEARCH_ALL_IAM_POLICIES_PAGE_STR_FACT =
554           new PagedListResponseFactory<
555               SearchAllIamPoliciesRequest,
556               SearchAllIamPoliciesResponse,
557               SearchAllIamPoliciesPagedResponse>() {
558             @Override
559             public ApiFuture<SearchAllIamPoliciesPagedResponse> getFuturePagedResponse(
560                 UnaryCallable<SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse> callable,
561                 SearchAllIamPoliciesRequest request,
562                 ApiCallContext context,
563                 ApiFuture<SearchAllIamPoliciesResponse> futureResponse) {
564               PageContext<
565                       SearchAllIamPoliciesRequest,
566                       SearchAllIamPoliciesResponse,
567                       IamPolicySearchResult>
568                   pageContext =
569                       PageContext.create(
570                           callable, SEARCH_ALL_IAM_POLICIES_PAGE_STR_DESC, request, context);
571               return SearchAllIamPoliciesPagedResponse.createAsync(pageContext, futureResponse);
572             }
573           };
574 
575   private static final PagedListResponseFactory<
576           ListSavedQueriesRequest, ListSavedQueriesResponse, ListSavedQueriesPagedResponse>
577       LIST_SAVED_QUERIES_PAGE_STR_FACT =
578           new PagedListResponseFactory<
579               ListSavedQueriesRequest, ListSavedQueriesResponse, ListSavedQueriesPagedResponse>() {
580             @Override
581             public ApiFuture<ListSavedQueriesPagedResponse> getFuturePagedResponse(
582                 UnaryCallable<ListSavedQueriesRequest, ListSavedQueriesResponse> callable,
583                 ListSavedQueriesRequest request,
584                 ApiCallContext context,
585                 ApiFuture<ListSavedQueriesResponse> futureResponse) {
586               PageContext<ListSavedQueriesRequest, ListSavedQueriesResponse, SavedQuery>
587                   pageContext =
588                       PageContext.create(
589                           callable, LIST_SAVED_QUERIES_PAGE_STR_DESC, request, context);
590               return ListSavedQueriesPagedResponse.createAsync(pageContext, futureResponse);
591             }
592           };
593 
594   private static final PagedListResponseFactory<
595           AnalyzeOrgPoliciesRequest, AnalyzeOrgPoliciesResponse, AnalyzeOrgPoliciesPagedResponse>
596       ANALYZE_ORG_POLICIES_PAGE_STR_FACT =
597           new PagedListResponseFactory<
598               AnalyzeOrgPoliciesRequest,
599               AnalyzeOrgPoliciesResponse,
600               AnalyzeOrgPoliciesPagedResponse>() {
601             @Override
602             public ApiFuture<AnalyzeOrgPoliciesPagedResponse> getFuturePagedResponse(
603                 UnaryCallable<AnalyzeOrgPoliciesRequest, AnalyzeOrgPoliciesResponse> callable,
604                 AnalyzeOrgPoliciesRequest request,
605                 ApiCallContext context,
606                 ApiFuture<AnalyzeOrgPoliciesResponse> futureResponse) {
607               PageContext<
608                       AnalyzeOrgPoliciesRequest,
609                       AnalyzeOrgPoliciesResponse,
610                       AnalyzeOrgPoliciesResponse.OrgPolicyResult>
611                   pageContext =
612                       PageContext.create(
613                           callable, ANALYZE_ORG_POLICIES_PAGE_STR_DESC, request, context);
614               return AnalyzeOrgPoliciesPagedResponse.createAsync(pageContext, futureResponse);
615             }
616           };
617 
618   private static final PagedListResponseFactory<
619           AnalyzeOrgPolicyGovernedContainersRequest,
620           AnalyzeOrgPolicyGovernedContainersResponse,
621           AnalyzeOrgPolicyGovernedContainersPagedResponse>
622       ANALYZE_ORG_POLICY_GOVERNED_CONTAINERS_PAGE_STR_FACT =
623           new PagedListResponseFactory<
624               AnalyzeOrgPolicyGovernedContainersRequest,
625               AnalyzeOrgPolicyGovernedContainersResponse,
626               AnalyzeOrgPolicyGovernedContainersPagedResponse>() {
627             @Override
628             public ApiFuture<AnalyzeOrgPolicyGovernedContainersPagedResponse>
629                 getFuturePagedResponse(
630                     UnaryCallable<
631                             AnalyzeOrgPolicyGovernedContainersRequest,
632                             AnalyzeOrgPolicyGovernedContainersResponse>
633                         callable,
634                     AnalyzeOrgPolicyGovernedContainersRequest request,
635                     ApiCallContext context,
636                     ApiFuture<AnalyzeOrgPolicyGovernedContainersResponse> futureResponse) {
637               PageContext<
638                       AnalyzeOrgPolicyGovernedContainersRequest,
639                       AnalyzeOrgPolicyGovernedContainersResponse,
640                       AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer>
641                   pageContext =
642                       PageContext.create(
643                           callable,
644                           ANALYZE_ORG_POLICY_GOVERNED_CONTAINERS_PAGE_STR_DESC,
645                           request,
646                           context);
647               return AnalyzeOrgPolicyGovernedContainersPagedResponse.createAsync(
648                   pageContext, futureResponse);
649             }
650           };
651 
652   private static final PagedListResponseFactory<
653           AnalyzeOrgPolicyGovernedAssetsRequest,
654           AnalyzeOrgPolicyGovernedAssetsResponse,
655           AnalyzeOrgPolicyGovernedAssetsPagedResponse>
656       ANALYZE_ORG_POLICY_GOVERNED_ASSETS_PAGE_STR_FACT =
657           new PagedListResponseFactory<
658               AnalyzeOrgPolicyGovernedAssetsRequest,
659               AnalyzeOrgPolicyGovernedAssetsResponse,
660               AnalyzeOrgPolicyGovernedAssetsPagedResponse>() {
661             @Override
662             public ApiFuture<AnalyzeOrgPolicyGovernedAssetsPagedResponse> getFuturePagedResponse(
663                 UnaryCallable<
664                         AnalyzeOrgPolicyGovernedAssetsRequest,
665                         AnalyzeOrgPolicyGovernedAssetsResponse>
666                     callable,
667                 AnalyzeOrgPolicyGovernedAssetsRequest request,
668                 ApiCallContext context,
669                 ApiFuture<AnalyzeOrgPolicyGovernedAssetsResponse> futureResponse) {
670               PageContext<
671                       AnalyzeOrgPolicyGovernedAssetsRequest,
672                       AnalyzeOrgPolicyGovernedAssetsResponse,
673                       AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset>
674                   pageContext =
675                       PageContext.create(
676                           callable,
677                           ANALYZE_ORG_POLICY_GOVERNED_ASSETS_PAGE_STR_DESC,
678                           request,
679                           context);
680               return AnalyzeOrgPolicyGovernedAssetsPagedResponse.createAsync(
681                   pageContext, futureResponse);
682             }
683           };
684 
685   /** Returns the object with the settings used for calls to exportAssets. */
exportAssetsSettings()686   public UnaryCallSettings<ExportAssetsRequest, Operation> exportAssetsSettings() {
687     return exportAssetsSettings;
688   }
689 
690   /** Returns the object with the settings used for calls to exportAssets. */
691   public OperationCallSettings<ExportAssetsRequest, ExportAssetsResponse, ExportAssetsRequest>
exportAssetsOperationSettings()692       exportAssetsOperationSettings() {
693     return exportAssetsOperationSettings;
694   }
695 
696   /** Returns the object with the settings used for calls to listAssets. */
697   public PagedCallSettings<ListAssetsRequest, ListAssetsResponse, ListAssetsPagedResponse>
listAssetsSettings()698       listAssetsSettings() {
699     return listAssetsSettings;
700   }
701 
702   /** Returns the object with the settings used for calls to batchGetAssetsHistory. */
703   public UnaryCallSettings<BatchGetAssetsHistoryRequest, BatchGetAssetsHistoryResponse>
batchGetAssetsHistorySettings()704       batchGetAssetsHistorySettings() {
705     return batchGetAssetsHistorySettings;
706   }
707 
708   /** Returns the object with the settings used for calls to createFeed. */
createFeedSettings()709   public UnaryCallSettings<CreateFeedRequest, Feed> createFeedSettings() {
710     return createFeedSettings;
711   }
712 
713   /** Returns the object with the settings used for calls to getFeed. */
getFeedSettings()714   public UnaryCallSettings<GetFeedRequest, Feed> getFeedSettings() {
715     return getFeedSettings;
716   }
717 
718   /** Returns the object with the settings used for calls to listFeeds. */
listFeedsSettings()719   public UnaryCallSettings<ListFeedsRequest, ListFeedsResponse> listFeedsSettings() {
720     return listFeedsSettings;
721   }
722 
723   /** Returns the object with the settings used for calls to updateFeed. */
updateFeedSettings()724   public UnaryCallSettings<UpdateFeedRequest, Feed> updateFeedSettings() {
725     return updateFeedSettings;
726   }
727 
728   /** Returns the object with the settings used for calls to deleteFeed. */
deleteFeedSettings()729   public UnaryCallSettings<DeleteFeedRequest, Empty> deleteFeedSettings() {
730     return deleteFeedSettings;
731   }
732 
733   /** Returns the object with the settings used for calls to searchAllResources. */
734   public PagedCallSettings<
735           SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse>
searchAllResourcesSettings()736       searchAllResourcesSettings() {
737     return searchAllResourcesSettings;
738   }
739 
740   /** Returns the object with the settings used for calls to searchAllIamPolicies. */
741   public PagedCallSettings<
742           SearchAllIamPoliciesRequest,
743           SearchAllIamPoliciesResponse,
744           SearchAllIamPoliciesPagedResponse>
searchAllIamPoliciesSettings()745       searchAllIamPoliciesSettings() {
746     return searchAllIamPoliciesSettings;
747   }
748 
749   /** Returns the object with the settings used for calls to analyzeIamPolicy. */
750   public UnaryCallSettings<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
analyzeIamPolicySettings()751       analyzeIamPolicySettings() {
752     return analyzeIamPolicySettings;
753   }
754 
755   /** Returns the object with the settings used for calls to analyzeIamPolicyLongrunning. */
756   public UnaryCallSettings<AnalyzeIamPolicyLongrunningRequest, Operation>
analyzeIamPolicyLongrunningSettings()757       analyzeIamPolicyLongrunningSettings() {
758     return analyzeIamPolicyLongrunningSettings;
759   }
760 
761   /** Returns the object with the settings used for calls to analyzeIamPolicyLongrunning. */
762   public OperationCallSettings<
763           AnalyzeIamPolicyLongrunningRequest,
764           AnalyzeIamPolicyLongrunningResponse,
765           AnalyzeIamPolicyLongrunningMetadata>
analyzeIamPolicyLongrunningOperationSettings()766       analyzeIamPolicyLongrunningOperationSettings() {
767     return analyzeIamPolicyLongrunningOperationSettings;
768   }
769 
770   /** Returns the object with the settings used for calls to analyzeMove. */
analyzeMoveSettings()771   public UnaryCallSettings<AnalyzeMoveRequest, AnalyzeMoveResponse> analyzeMoveSettings() {
772     return analyzeMoveSettings;
773   }
774 
775   /** Returns the object with the settings used for calls to queryAssets. */
queryAssetsSettings()776   public UnaryCallSettings<QueryAssetsRequest, QueryAssetsResponse> queryAssetsSettings() {
777     return queryAssetsSettings;
778   }
779 
780   /** Returns the object with the settings used for calls to createSavedQuery. */
createSavedQuerySettings()781   public UnaryCallSettings<CreateSavedQueryRequest, SavedQuery> createSavedQuerySettings() {
782     return createSavedQuerySettings;
783   }
784 
785   /** Returns the object with the settings used for calls to getSavedQuery. */
getSavedQuerySettings()786   public UnaryCallSettings<GetSavedQueryRequest, SavedQuery> getSavedQuerySettings() {
787     return getSavedQuerySettings;
788   }
789 
790   /** Returns the object with the settings used for calls to listSavedQueries. */
791   public PagedCallSettings<
792           ListSavedQueriesRequest, ListSavedQueriesResponse, ListSavedQueriesPagedResponse>
listSavedQueriesSettings()793       listSavedQueriesSettings() {
794     return listSavedQueriesSettings;
795   }
796 
797   /** Returns the object with the settings used for calls to updateSavedQuery. */
updateSavedQuerySettings()798   public UnaryCallSettings<UpdateSavedQueryRequest, SavedQuery> updateSavedQuerySettings() {
799     return updateSavedQuerySettings;
800   }
801 
802   /** Returns the object with the settings used for calls to deleteSavedQuery. */
deleteSavedQuerySettings()803   public UnaryCallSettings<DeleteSavedQueryRequest, Empty> deleteSavedQuerySettings() {
804     return deleteSavedQuerySettings;
805   }
806 
807   /** Returns the object with the settings used for calls to batchGetEffectiveIamPolicies. */
808   public UnaryCallSettings<
809           BatchGetEffectiveIamPoliciesRequest, BatchGetEffectiveIamPoliciesResponse>
batchGetEffectiveIamPoliciesSettings()810       batchGetEffectiveIamPoliciesSettings() {
811     return batchGetEffectiveIamPoliciesSettings;
812   }
813 
814   /** Returns the object with the settings used for calls to analyzeOrgPolicies. */
815   public PagedCallSettings<
816           AnalyzeOrgPoliciesRequest, AnalyzeOrgPoliciesResponse, AnalyzeOrgPoliciesPagedResponse>
analyzeOrgPoliciesSettings()817       analyzeOrgPoliciesSettings() {
818     return analyzeOrgPoliciesSettings;
819   }
820 
821   /** Returns the object with the settings used for calls to analyzeOrgPolicyGovernedContainers. */
822   public PagedCallSettings<
823           AnalyzeOrgPolicyGovernedContainersRequest,
824           AnalyzeOrgPolicyGovernedContainersResponse,
825           AnalyzeOrgPolicyGovernedContainersPagedResponse>
analyzeOrgPolicyGovernedContainersSettings()826       analyzeOrgPolicyGovernedContainersSettings() {
827     return analyzeOrgPolicyGovernedContainersSettings;
828   }
829 
830   /** Returns the object with the settings used for calls to analyzeOrgPolicyGovernedAssets. */
831   public PagedCallSettings<
832           AnalyzeOrgPolicyGovernedAssetsRequest,
833           AnalyzeOrgPolicyGovernedAssetsResponse,
834           AnalyzeOrgPolicyGovernedAssetsPagedResponse>
analyzeOrgPolicyGovernedAssetsSettings()835       analyzeOrgPolicyGovernedAssetsSettings() {
836     return analyzeOrgPolicyGovernedAssetsSettings;
837   }
838 
createStub()839   public AssetServiceStub createStub() throws IOException {
840     if (getTransportChannelProvider()
841         .getTransportName()
842         .equals(GrpcTransportChannel.getGrpcTransportName())) {
843       return GrpcAssetServiceStub.create(this);
844     }
845     if (getTransportChannelProvider()
846         .getTransportName()
847         .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
848       return HttpJsonAssetServiceStub.create(this);
849     }
850     throw new UnsupportedOperationException(
851         String.format(
852             "Transport not supported: %s", getTransportChannelProvider().getTransportName()));
853   }
854 
855   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()856   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
857     return InstantiatingExecutorProvider.newBuilder();
858   }
859 
860   /** Returns the default service endpoint. */
getDefaultEndpoint()861   public static String getDefaultEndpoint() {
862     return "cloudasset.googleapis.com:443";
863   }
864 
865   /** Returns the default mTLS service endpoint. */
getDefaultMtlsEndpoint()866   public static String getDefaultMtlsEndpoint() {
867     return "cloudasset.mtls.googleapis.com:443";
868   }
869 
870   /** Returns the default service scopes. */
getDefaultServiceScopes()871   public static List<String> getDefaultServiceScopes() {
872     return DEFAULT_SERVICE_SCOPES;
873   }
874 
875   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()876   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
877     return GoogleCredentialsProvider.newBuilder()
878         .setScopesToApply(DEFAULT_SERVICE_SCOPES)
879         .setUseJwtAccessWithScope(true);
880   }
881 
882   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()883   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
884     return InstantiatingGrpcChannelProvider.newBuilder()
885         .setMaxInboundMessageSize(Integer.MAX_VALUE);
886   }
887 
888   /** Returns a builder for the default REST ChannelProvider for this service. */
889   @BetaApi
890   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()891       defaultHttpJsonTransportProviderBuilder() {
892     return InstantiatingHttpJsonChannelProvider.newBuilder();
893   }
894 
defaultTransportChannelProvider()895   public static TransportChannelProvider defaultTransportChannelProvider() {
896     return defaultGrpcTransportProviderBuilder().build();
897   }
898 
899   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultGrpcApiClientHeaderProviderBuilder()900   public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
901     return ApiClientHeaderProvider.newBuilder()
902         .setGeneratedLibToken(
903             "gapic", GaxProperties.getLibraryVersion(AssetServiceStubSettings.class))
904         .setTransportToken(
905             GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
906   }
907 
908   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultHttpJsonApiClientHeaderProviderBuilder()909   public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
910     return ApiClientHeaderProvider.newBuilder()
911         .setGeneratedLibToken(
912             "gapic", GaxProperties.getLibraryVersion(AssetServiceStubSettings.class))
913         .setTransportToken(
914             GaxHttpJsonProperties.getHttpJsonTokenName(),
915             GaxHttpJsonProperties.getHttpJsonVersion());
916   }
917 
defaultApiClientHeaderProviderBuilder()918   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
919     return AssetServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
920   }
921 
922   /** Returns a new gRPC builder for this class. */
newBuilder()923   public static Builder newBuilder() {
924     return Builder.createDefault();
925   }
926 
927   /** Returns a new REST builder for this class. */
newHttpJsonBuilder()928   public static Builder newHttpJsonBuilder() {
929     return Builder.createHttpJsonDefault();
930   }
931 
932   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)933   public static Builder newBuilder(ClientContext clientContext) {
934     return new Builder(clientContext);
935   }
936 
937   /** Returns a builder containing all the values of this settings class. */
toBuilder()938   public Builder toBuilder() {
939     return new Builder(this);
940   }
941 
AssetServiceStubSettings(Builder settingsBuilder)942   protected AssetServiceStubSettings(Builder settingsBuilder) throws IOException {
943     super(settingsBuilder);
944 
945     exportAssetsSettings = settingsBuilder.exportAssetsSettings().build();
946     exportAssetsOperationSettings = settingsBuilder.exportAssetsOperationSettings().build();
947     listAssetsSettings = settingsBuilder.listAssetsSettings().build();
948     batchGetAssetsHistorySettings = settingsBuilder.batchGetAssetsHistorySettings().build();
949     createFeedSettings = settingsBuilder.createFeedSettings().build();
950     getFeedSettings = settingsBuilder.getFeedSettings().build();
951     listFeedsSettings = settingsBuilder.listFeedsSettings().build();
952     updateFeedSettings = settingsBuilder.updateFeedSettings().build();
953     deleteFeedSettings = settingsBuilder.deleteFeedSettings().build();
954     searchAllResourcesSettings = settingsBuilder.searchAllResourcesSettings().build();
955     searchAllIamPoliciesSettings = settingsBuilder.searchAllIamPoliciesSettings().build();
956     analyzeIamPolicySettings = settingsBuilder.analyzeIamPolicySettings().build();
957     analyzeIamPolicyLongrunningSettings =
958         settingsBuilder.analyzeIamPolicyLongrunningSettings().build();
959     analyzeIamPolicyLongrunningOperationSettings =
960         settingsBuilder.analyzeIamPolicyLongrunningOperationSettings().build();
961     analyzeMoveSettings = settingsBuilder.analyzeMoveSettings().build();
962     queryAssetsSettings = settingsBuilder.queryAssetsSettings().build();
963     createSavedQuerySettings = settingsBuilder.createSavedQuerySettings().build();
964     getSavedQuerySettings = settingsBuilder.getSavedQuerySettings().build();
965     listSavedQueriesSettings = settingsBuilder.listSavedQueriesSettings().build();
966     updateSavedQuerySettings = settingsBuilder.updateSavedQuerySettings().build();
967     deleteSavedQuerySettings = settingsBuilder.deleteSavedQuerySettings().build();
968     batchGetEffectiveIamPoliciesSettings =
969         settingsBuilder.batchGetEffectiveIamPoliciesSettings().build();
970     analyzeOrgPoliciesSettings = settingsBuilder.analyzeOrgPoliciesSettings().build();
971     analyzeOrgPolicyGovernedContainersSettings =
972         settingsBuilder.analyzeOrgPolicyGovernedContainersSettings().build();
973     analyzeOrgPolicyGovernedAssetsSettings =
974         settingsBuilder.analyzeOrgPolicyGovernedAssetsSettings().build();
975   }
976 
977   /** Builder for AssetServiceStubSettings. */
978   public static class Builder extends StubSettings.Builder<AssetServiceStubSettings, Builder> {
979     private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders;
980     private final UnaryCallSettings.Builder<ExportAssetsRequest, Operation> exportAssetsSettings;
981     private final OperationCallSettings.Builder<
982             ExportAssetsRequest, ExportAssetsResponse, ExportAssetsRequest>
983         exportAssetsOperationSettings;
984     private final PagedCallSettings.Builder<
985             ListAssetsRequest, ListAssetsResponse, ListAssetsPagedResponse>
986         listAssetsSettings;
987     private final UnaryCallSettings.Builder<
988             BatchGetAssetsHistoryRequest, BatchGetAssetsHistoryResponse>
989         batchGetAssetsHistorySettings;
990     private final UnaryCallSettings.Builder<CreateFeedRequest, Feed> createFeedSettings;
991     private final UnaryCallSettings.Builder<GetFeedRequest, Feed> getFeedSettings;
992     private final UnaryCallSettings.Builder<ListFeedsRequest, ListFeedsResponse> listFeedsSettings;
993     private final UnaryCallSettings.Builder<UpdateFeedRequest, Feed> updateFeedSettings;
994     private final UnaryCallSettings.Builder<DeleteFeedRequest, Empty> deleteFeedSettings;
995     private final PagedCallSettings.Builder<
996             SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse>
997         searchAllResourcesSettings;
998     private final PagedCallSettings.Builder<
999             SearchAllIamPoliciesRequest,
1000             SearchAllIamPoliciesResponse,
1001             SearchAllIamPoliciesPagedResponse>
1002         searchAllIamPoliciesSettings;
1003     private final UnaryCallSettings.Builder<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
1004         analyzeIamPolicySettings;
1005     private final UnaryCallSettings.Builder<AnalyzeIamPolicyLongrunningRequest, Operation>
1006         analyzeIamPolicyLongrunningSettings;
1007     private final OperationCallSettings.Builder<
1008             AnalyzeIamPolicyLongrunningRequest,
1009             AnalyzeIamPolicyLongrunningResponse,
1010             AnalyzeIamPolicyLongrunningMetadata>
1011         analyzeIamPolicyLongrunningOperationSettings;
1012     private final UnaryCallSettings.Builder<AnalyzeMoveRequest, AnalyzeMoveResponse>
1013         analyzeMoveSettings;
1014     private final UnaryCallSettings.Builder<QueryAssetsRequest, QueryAssetsResponse>
1015         queryAssetsSettings;
1016     private final UnaryCallSettings.Builder<CreateSavedQueryRequest, SavedQuery>
1017         createSavedQuerySettings;
1018     private final UnaryCallSettings.Builder<GetSavedQueryRequest, SavedQuery> getSavedQuerySettings;
1019     private final PagedCallSettings.Builder<
1020             ListSavedQueriesRequest, ListSavedQueriesResponse, ListSavedQueriesPagedResponse>
1021         listSavedQueriesSettings;
1022     private final UnaryCallSettings.Builder<UpdateSavedQueryRequest, SavedQuery>
1023         updateSavedQuerySettings;
1024     private final UnaryCallSettings.Builder<DeleteSavedQueryRequest, Empty>
1025         deleteSavedQuerySettings;
1026     private final UnaryCallSettings.Builder<
1027             BatchGetEffectiveIamPoliciesRequest, BatchGetEffectiveIamPoliciesResponse>
1028         batchGetEffectiveIamPoliciesSettings;
1029     private final PagedCallSettings.Builder<
1030             AnalyzeOrgPoliciesRequest, AnalyzeOrgPoliciesResponse, AnalyzeOrgPoliciesPagedResponse>
1031         analyzeOrgPoliciesSettings;
1032     private final PagedCallSettings.Builder<
1033             AnalyzeOrgPolicyGovernedContainersRequest,
1034             AnalyzeOrgPolicyGovernedContainersResponse,
1035             AnalyzeOrgPolicyGovernedContainersPagedResponse>
1036         analyzeOrgPolicyGovernedContainersSettings;
1037     private final PagedCallSettings.Builder<
1038             AnalyzeOrgPolicyGovernedAssetsRequest,
1039             AnalyzeOrgPolicyGovernedAssetsResponse,
1040             AnalyzeOrgPolicyGovernedAssetsPagedResponse>
1041         analyzeOrgPolicyGovernedAssetsSettings;
1042     private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
1043         RETRYABLE_CODE_DEFINITIONS;
1044 
1045     static {
1046       ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
1047           ImmutableMap.builder();
1048       definitions.put(
1049           "no_retry_0_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
1050       definitions.put(
1051           "retry_policy_1_codes",
1052           ImmutableSet.copyOf(
1053               Lists.<StatusCode.Code>newArrayList(
1054                   StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
1055       definitions.put(
1056           "retry_policy_2_codes",
1057           ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
1058       definitions.put(
1059           "retry_policy_3_codes",
1060           ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
1061       definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
1062       definitions.put(
1063           "retry_policy_4_codes",
1064           ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
1065       definitions.put(
1066           "retry_policy_6_codes",
1067           ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
1068       RETRYABLE_CODE_DEFINITIONS = definitions.build();
1069     }
1070 
1071     private static final ImmutableMap<String, RetrySettings> RETRY_PARAM_DEFINITIONS;
1072 
1073     static {
1074       ImmutableMap.Builder<String, RetrySettings> definitions = ImmutableMap.builder();
1075       RetrySettings settings = null;
1076       settings =
1077           RetrySettings.newBuilder()
1078               .setInitialRpcTimeout(Duration.ofMillis(60000L))
1079               .setRpcTimeoutMultiplier(1.0)
1080               .setMaxRpcTimeout(Duration.ofMillis(60000L))
1081               .setTotalTimeout(Duration.ofMillis(60000L))
1082               .build();
1083       definitions.put("no_retry_0_params", settings);
1084       settings =
1085           RetrySettings.newBuilder()
1086               .setInitialRetryDelay(Duration.ofMillis(100L))
1087               .setRetryDelayMultiplier(1.3)
1088               .setMaxRetryDelay(Duration.ofMillis(60000L))
1089               .setInitialRpcTimeout(Duration.ofMillis(60000L))
1090               .setRpcTimeoutMultiplier(1.0)
1091               .setMaxRpcTimeout(Duration.ofMillis(60000L))
1092               .setTotalTimeout(Duration.ofMillis(60000L))
1093               .build();
1094       definitions.put("retry_policy_1_params", settings);
1095       settings =
1096           RetrySettings.newBuilder()
1097               .setInitialRetryDelay(Duration.ofMillis(100L))
1098               .setRetryDelayMultiplier(1.3)
1099               .setMaxRetryDelay(Duration.ofMillis(60000L))
1100               .setInitialRpcTimeout(Duration.ofMillis(30000L))
1101               .setRpcTimeoutMultiplier(1.0)
1102               .setMaxRpcTimeout(Duration.ofMillis(30000L))
1103               .setTotalTimeout(Duration.ofMillis(30000L))
1104               .build();
1105       definitions.put("retry_policy_2_params", settings);
1106       settings =
1107           RetrySettings.newBuilder()
1108               .setInitialRetryDelay(Duration.ofMillis(100L))
1109               .setRetryDelayMultiplier(1.3)
1110               .setMaxRetryDelay(Duration.ofMillis(60000L))
1111               .setInitialRpcTimeout(Duration.ofMillis(300000L))
1112               .setRpcTimeoutMultiplier(1.0)
1113               .setMaxRpcTimeout(Duration.ofMillis(300000L))
1114               .setTotalTimeout(Duration.ofMillis(300000L))
1115               .build();
1116       definitions.put("retry_policy_3_params", settings);
1117       settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
1118       definitions.put("no_retry_params", settings);
1119       settings =
1120           RetrySettings.newBuilder()
1121               .setInitialRetryDelay(Duration.ofMillis(100L))
1122               .setRetryDelayMultiplier(1.3)
1123               .setMaxRetryDelay(Duration.ofMillis(60000L))
1124               .setInitialRpcTimeout(Duration.ofMillis(200000L))
1125               .setRpcTimeoutMultiplier(1.0)
1126               .setMaxRpcTimeout(Duration.ofMillis(200000L))
1127               .setTotalTimeout(Duration.ofMillis(200000L))
1128               .build();
1129       definitions.put("retry_policy_4_params", settings);
1130       settings =
1131           RetrySettings.newBuilder()
1132               .setInitialRetryDelay(Duration.ofMillis(100L))
1133               .setRetryDelayMultiplier(1.3)
1134               .setMaxRetryDelay(Duration.ofMillis(60000L))
1135               .setInitialRpcTimeout(Duration.ofMillis(300000L))
1136               .setRpcTimeoutMultiplier(1.0)
1137               .setMaxRpcTimeout(Duration.ofMillis(300000L))
1138               .setTotalTimeout(Duration.ofMillis(300000L))
1139               .build();
1140       definitions.put("retry_policy_6_params", settings);
1141       RETRY_PARAM_DEFINITIONS = definitions.build();
1142     }
1143 
Builder()1144     protected Builder() {
1145       this(((ClientContext) null));
1146     }
1147 
Builder(ClientContext clientContext)1148     protected Builder(ClientContext clientContext) {
1149       super(clientContext);
1150 
1151       exportAssetsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1152       exportAssetsOperationSettings = OperationCallSettings.newBuilder();
1153       listAssetsSettings = PagedCallSettings.newBuilder(LIST_ASSETS_PAGE_STR_FACT);
1154       batchGetAssetsHistorySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1155       createFeedSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1156       getFeedSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1157       listFeedsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1158       updateFeedSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1159       deleteFeedSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1160       searchAllResourcesSettings = PagedCallSettings.newBuilder(SEARCH_ALL_RESOURCES_PAGE_STR_FACT);
1161       searchAllIamPoliciesSettings =
1162           PagedCallSettings.newBuilder(SEARCH_ALL_IAM_POLICIES_PAGE_STR_FACT);
1163       analyzeIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1164       analyzeIamPolicyLongrunningSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1165       analyzeIamPolicyLongrunningOperationSettings = OperationCallSettings.newBuilder();
1166       analyzeMoveSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1167       queryAssetsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1168       createSavedQuerySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1169       getSavedQuerySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1170       listSavedQueriesSettings = PagedCallSettings.newBuilder(LIST_SAVED_QUERIES_PAGE_STR_FACT);
1171       updateSavedQuerySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1172       deleteSavedQuerySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1173       batchGetEffectiveIamPoliciesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
1174       analyzeOrgPoliciesSettings = PagedCallSettings.newBuilder(ANALYZE_ORG_POLICIES_PAGE_STR_FACT);
1175       analyzeOrgPolicyGovernedContainersSettings =
1176           PagedCallSettings.newBuilder(ANALYZE_ORG_POLICY_GOVERNED_CONTAINERS_PAGE_STR_FACT);
1177       analyzeOrgPolicyGovernedAssetsSettings =
1178           PagedCallSettings.newBuilder(ANALYZE_ORG_POLICY_GOVERNED_ASSETS_PAGE_STR_FACT);
1179 
1180       unaryMethodSettingsBuilders =
1181           ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
1182               exportAssetsSettings,
1183               listAssetsSettings,
1184               batchGetAssetsHistorySettings,
1185               createFeedSettings,
1186               getFeedSettings,
1187               listFeedsSettings,
1188               updateFeedSettings,
1189               deleteFeedSettings,
1190               searchAllResourcesSettings,
1191               searchAllIamPoliciesSettings,
1192               analyzeIamPolicySettings,
1193               analyzeIamPolicyLongrunningSettings,
1194               analyzeMoveSettings,
1195               queryAssetsSettings,
1196               createSavedQuerySettings,
1197               getSavedQuerySettings,
1198               listSavedQueriesSettings,
1199               updateSavedQuerySettings,
1200               deleteSavedQuerySettings,
1201               batchGetEffectiveIamPoliciesSettings,
1202               analyzeOrgPoliciesSettings,
1203               analyzeOrgPolicyGovernedContainersSettings,
1204               analyzeOrgPolicyGovernedAssetsSettings);
1205       initDefaults(this);
1206     }
1207 
Builder(AssetServiceStubSettings settings)1208     protected Builder(AssetServiceStubSettings settings) {
1209       super(settings);
1210 
1211       exportAssetsSettings = settings.exportAssetsSettings.toBuilder();
1212       exportAssetsOperationSettings = settings.exportAssetsOperationSettings.toBuilder();
1213       listAssetsSettings = settings.listAssetsSettings.toBuilder();
1214       batchGetAssetsHistorySettings = settings.batchGetAssetsHistorySettings.toBuilder();
1215       createFeedSettings = settings.createFeedSettings.toBuilder();
1216       getFeedSettings = settings.getFeedSettings.toBuilder();
1217       listFeedsSettings = settings.listFeedsSettings.toBuilder();
1218       updateFeedSettings = settings.updateFeedSettings.toBuilder();
1219       deleteFeedSettings = settings.deleteFeedSettings.toBuilder();
1220       searchAllResourcesSettings = settings.searchAllResourcesSettings.toBuilder();
1221       searchAllIamPoliciesSettings = settings.searchAllIamPoliciesSettings.toBuilder();
1222       analyzeIamPolicySettings = settings.analyzeIamPolicySettings.toBuilder();
1223       analyzeIamPolicyLongrunningSettings =
1224           settings.analyzeIamPolicyLongrunningSettings.toBuilder();
1225       analyzeIamPolicyLongrunningOperationSettings =
1226           settings.analyzeIamPolicyLongrunningOperationSettings.toBuilder();
1227       analyzeMoveSettings = settings.analyzeMoveSettings.toBuilder();
1228       queryAssetsSettings = settings.queryAssetsSettings.toBuilder();
1229       createSavedQuerySettings = settings.createSavedQuerySettings.toBuilder();
1230       getSavedQuerySettings = settings.getSavedQuerySettings.toBuilder();
1231       listSavedQueriesSettings = settings.listSavedQueriesSettings.toBuilder();
1232       updateSavedQuerySettings = settings.updateSavedQuerySettings.toBuilder();
1233       deleteSavedQuerySettings = settings.deleteSavedQuerySettings.toBuilder();
1234       batchGetEffectiveIamPoliciesSettings =
1235           settings.batchGetEffectiveIamPoliciesSettings.toBuilder();
1236       analyzeOrgPoliciesSettings = settings.analyzeOrgPoliciesSettings.toBuilder();
1237       analyzeOrgPolicyGovernedContainersSettings =
1238           settings.analyzeOrgPolicyGovernedContainersSettings.toBuilder();
1239       analyzeOrgPolicyGovernedAssetsSettings =
1240           settings.analyzeOrgPolicyGovernedAssetsSettings.toBuilder();
1241 
1242       unaryMethodSettingsBuilders =
1243           ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
1244               exportAssetsSettings,
1245               listAssetsSettings,
1246               batchGetAssetsHistorySettings,
1247               createFeedSettings,
1248               getFeedSettings,
1249               listFeedsSettings,
1250               updateFeedSettings,
1251               deleteFeedSettings,
1252               searchAllResourcesSettings,
1253               searchAllIamPoliciesSettings,
1254               analyzeIamPolicySettings,
1255               analyzeIamPolicyLongrunningSettings,
1256               analyzeMoveSettings,
1257               queryAssetsSettings,
1258               createSavedQuerySettings,
1259               getSavedQuerySettings,
1260               listSavedQueriesSettings,
1261               updateSavedQuerySettings,
1262               deleteSavedQuerySettings,
1263               batchGetEffectiveIamPoliciesSettings,
1264               analyzeOrgPoliciesSettings,
1265               analyzeOrgPolicyGovernedContainersSettings,
1266               analyzeOrgPolicyGovernedAssetsSettings);
1267     }
1268 
createDefault()1269     private static Builder createDefault() {
1270       Builder builder = new Builder(((ClientContext) null));
1271 
1272       builder.setTransportChannelProvider(defaultTransportChannelProvider());
1273       builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
1274       builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
1275       builder.setEndpoint(getDefaultEndpoint());
1276       builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
1277       builder.setSwitchToMtlsEndpointAllowed(true);
1278 
1279       return initDefaults(builder);
1280     }
1281 
createHttpJsonDefault()1282     private static Builder createHttpJsonDefault() {
1283       Builder builder = new Builder(((ClientContext) null));
1284 
1285       builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
1286       builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
1287       builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
1288       builder.setEndpoint(getDefaultEndpoint());
1289       builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
1290       builder.setSwitchToMtlsEndpointAllowed(true);
1291 
1292       return initDefaults(builder);
1293     }
1294 
initDefaults(Builder builder)1295     private static Builder initDefaults(Builder builder) {
1296       builder
1297           .exportAssetsSettings()
1298           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
1299           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
1300 
1301       builder
1302           .listAssetsSettings()
1303           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
1304           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
1305 
1306       builder
1307           .batchGetAssetsHistorySettings()
1308           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
1309           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
1310 
1311       builder
1312           .createFeedSettings()
1313           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
1314           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
1315 
1316       builder
1317           .getFeedSettings()
1318           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
1319           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
1320 
1321       builder
1322           .listFeedsSettings()
1323           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
1324           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
1325 
1326       builder
1327           .updateFeedSettings()
1328           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
1329           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
1330 
1331       builder
1332           .deleteFeedSettings()
1333           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
1334           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
1335 
1336       builder
1337           .searchAllResourcesSettings()
1338           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
1339           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
1340 
1341       builder
1342           .searchAllIamPoliciesSettings()
1343           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
1344           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
1345 
1346       builder
1347           .analyzeIamPolicySettings()
1348           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes"))
1349           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params"));
1350 
1351       builder
1352           .analyzeIamPolicyLongrunningSettings()
1353           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
1354           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
1355 
1356       builder
1357           .analyzeMoveSettings()
1358           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
1359           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
1360 
1361       builder
1362           .queryAssetsSettings()
1363           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_4_codes"))
1364           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_4_params"));
1365 
1366       builder
1367           .createSavedQuerySettings()
1368           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
1369           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
1370 
1371       builder
1372           .getSavedQuerySettings()
1373           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
1374           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
1375 
1376       builder
1377           .listSavedQueriesSettings()
1378           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
1379           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
1380 
1381       builder
1382           .updateSavedQuerySettings()
1383           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
1384           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
1385 
1386       builder
1387           .deleteSavedQuerySettings()
1388           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
1389           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
1390 
1391       builder
1392           .batchGetEffectiveIamPoliciesSettings()
1393           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes"))
1394           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params"));
1395 
1396       builder
1397           .analyzeOrgPoliciesSettings()
1398           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
1399           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
1400 
1401       builder
1402           .analyzeOrgPolicyGovernedContainersSettings()
1403           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
1404           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
1405 
1406       builder
1407           .analyzeOrgPolicyGovernedAssetsSettings()
1408           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
1409           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
1410 
1411       builder
1412           .exportAssetsOperationSettings()
1413           .setInitialCallSettings(
1414               UnaryCallSettings
1415                   .<ExportAssetsRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
1416                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
1417                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"))
1418                   .build())
1419           .setResponseTransformer(
1420               ProtoOperationTransformers.ResponseTransformer.create(ExportAssetsResponse.class))
1421           .setMetadataTransformer(
1422               ProtoOperationTransformers.MetadataTransformer.create(ExportAssetsRequest.class))
1423           .setPollingAlgorithm(
1424               OperationTimedPollAlgorithm.create(
1425                   RetrySettings.newBuilder()
1426                       .setInitialRetryDelay(Duration.ofMillis(5000L))
1427                       .setRetryDelayMultiplier(1.5)
1428                       .setMaxRetryDelay(Duration.ofMillis(45000L))
1429                       .setInitialRpcTimeout(Duration.ZERO)
1430                       .setRpcTimeoutMultiplier(1.0)
1431                       .setMaxRpcTimeout(Duration.ZERO)
1432                       .setTotalTimeout(Duration.ofMillis(300000L))
1433                       .build()));
1434 
1435       builder
1436           .analyzeIamPolicyLongrunningOperationSettings()
1437           .setInitialCallSettings(
1438               UnaryCallSettings
1439                   .<AnalyzeIamPolicyLongrunningRequest, OperationSnapshot>
1440                       newUnaryCallSettingsBuilder()
1441                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
1442                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"))
1443                   .build())
1444           .setResponseTransformer(
1445               ProtoOperationTransformers.ResponseTransformer.create(
1446                   AnalyzeIamPolicyLongrunningResponse.class))
1447           .setMetadataTransformer(
1448               ProtoOperationTransformers.MetadataTransformer.create(
1449                   AnalyzeIamPolicyLongrunningMetadata.class))
1450           .setPollingAlgorithm(
1451               OperationTimedPollAlgorithm.create(
1452                   RetrySettings.newBuilder()
1453                       .setInitialRetryDelay(Duration.ofMillis(5000L))
1454                       .setRetryDelayMultiplier(1.5)
1455                       .setMaxRetryDelay(Duration.ofMillis(45000L))
1456                       .setInitialRpcTimeout(Duration.ZERO)
1457                       .setRpcTimeoutMultiplier(1.0)
1458                       .setMaxRpcTimeout(Duration.ZERO)
1459                       .setTotalTimeout(Duration.ofMillis(300000L))
1460                       .build()));
1461 
1462       return builder;
1463     }
1464 
1465     /**
1466      * Applies the given settings updater function to all of the unary API methods in this service.
1467      *
1468      * <p>Note: This method does not support applying settings to streaming methods.
1469      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)1470     public Builder applyToAllUnaryMethods(
1471         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
1472       super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
1473       return this;
1474     }
1475 
unaryMethodSettingsBuilders()1476     public ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders() {
1477       return unaryMethodSettingsBuilders;
1478     }
1479 
1480     /** Returns the builder for the settings used for calls to exportAssets. */
exportAssetsSettings()1481     public UnaryCallSettings.Builder<ExportAssetsRequest, Operation> exportAssetsSettings() {
1482       return exportAssetsSettings;
1483     }
1484 
1485     /** Returns the builder for the settings used for calls to exportAssets. */
1486     @BetaApi(
1487         "The surface for use by generated code is not stable yet and may change in the future.")
1488     public OperationCallSettings.Builder<
1489             ExportAssetsRequest, ExportAssetsResponse, ExportAssetsRequest>
exportAssetsOperationSettings()1490         exportAssetsOperationSettings() {
1491       return exportAssetsOperationSettings;
1492     }
1493 
1494     /** Returns the builder for the settings used for calls to listAssets. */
1495     public PagedCallSettings.Builder<ListAssetsRequest, ListAssetsResponse, ListAssetsPagedResponse>
listAssetsSettings()1496         listAssetsSettings() {
1497       return listAssetsSettings;
1498     }
1499 
1500     /** Returns the builder for the settings used for calls to batchGetAssetsHistory. */
1501     public UnaryCallSettings.Builder<BatchGetAssetsHistoryRequest, BatchGetAssetsHistoryResponse>
batchGetAssetsHistorySettings()1502         batchGetAssetsHistorySettings() {
1503       return batchGetAssetsHistorySettings;
1504     }
1505 
1506     /** Returns the builder for the settings used for calls to createFeed. */
createFeedSettings()1507     public UnaryCallSettings.Builder<CreateFeedRequest, Feed> createFeedSettings() {
1508       return createFeedSettings;
1509     }
1510 
1511     /** Returns the builder for the settings used for calls to getFeed. */
getFeedSettings()1512     public UnaryCallSettings.Builder<GetFeedRequest, Feed> getFeedSettings() {
1513       return getFeedSettings;
1514     }
1515 
1516     /** Returns the builder for the settings used for calls to listFeeds. */
listFeedsSettings()1517     public UnaryCallSettings.Builder<ListFeedsRequest, ListFeedsResponse> listFeedsSettings() {
1518       return listFeedsSettings;
1519     }
1520 
1521     /** Returns the builder for the settings used for calls to updateFeed. */
updateFeedSettings()1522     public UnaryCallSettings.Builder<UpdateFeedRequest, Feed> updateFeedSettings() {
1523       return updateFeedSettings;
1524     }
1525 
1526     /** Returns the builder for the settings used for calls to deleteFeed. */
deleteFeedSettings()1527     public UnaryCallSettings.Builder<DeleteFeedRequest, Empty> deleteFeedSettings() {
1528       return deleteFeedSettings;
1529     }
1530 
1531     /** Returns the builder for the settings used for calls to searchAllResources. */
1532     public PagedCallSettings.Builder<
1533             SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse>
searchAllResourcesSettings()1534         searchAllResourcesSettings() {
1535       return searchAllResourcesSettings;
1536     }
1537 
1538     /** Returns the builder for the settings used for calls to searchAllIamPolicies. */
1539     public PagedCallSettings.Builder<
1540             SearchAllIamPoliciesRequest,
1541             SearchAllIamPoliciesResponse,
1542             SearchAllIamPoliciesPagedResponse>
searchAllIamPoliciesSettings()1543         searchAllIamPoliciesSettings() {
1544       return searchAllIamPoliciesSettings;
1545     }
1546 
1547     /** Returns the builder for the settings used for calls to analyzeIamPolicy. */
1548     public UnaryCallSettings.Builder<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
analyzeIamPolicySettings()1549         analyzeIamPolicySettings() {
1550       return analyzeIamPolicySettings;
1551     }
1552 
1553     /** Returns the builder for the settings used for calls to analyzeIamPolicyLongrunning. */
1554     public UnaryCallSettings.Builder<AnalyzeIamPolicyLongrunningRequest, Operation>
analyzeIamPolicyLongrunningSettings()1555         analyzeIamPolicyLongrunningSettings() {
1556       return analyzeIamPolicyLongrunningSettings;
1557     }
1558 
1559     /** Returns the builder for the settings used for calls to analyzeIamPolicyLongrunning. */
1560     @BetaApi(
1561         "The surface for use by generated code is not stable yet and may change in the future.")
1562     public OperationCallSettings.Builder<
1563             AnalyzeIamPolicyLongrunningRequest,
1564             AnalyzeIamPolicyLongrunningResponse,
1565             AnalyzeIamPolicyLongrunningMetadata>
analyzeIamPolicyLongrunningOperationSettings()1566         analyzeIamPolicyLongrunningOperationSettings() {
1567       return analyzeIamPolicyLongrunningOperationSettings;
1568     }
1569 
1570     /** Returns the builder for the settings used for calls to analyzeMove. */
1571     public UnaryCallSettings.Builder<AnalyzeMoveRequest, AnalyzeMoveResponse>
analyzeMoveSettings()1572         analyzeMoveSettings() {
1573       return analyzeMoveSettings;
1574     }
1575 
1576     /** Returns the builder for the settings used for calls to queryAssets. */
1577     public UnaryCallSettings.Builder<QueryAssetsRequest, QueryAssetsResponse>
queryAssetsSettings()1578         queryAssetsSettings() {
1579       return queryAssetsSettings;
1580     }
1581 
1582     /** Returns the builder for the settings used for calls to createSavedQuery. */
1583     public UnaryCallSettings.Builder<CreateSavedQueryRequest, SavedQuery>
createSavedQuerySettings()1584         createSavedQuerySettings() {
1585       return createSavedQuerySettings;
1586     }
1587 
1588     /** Returns the builder for the settings used for calls to getSavedQuery. */
getSavedQuerySettings()1589     public UnaryCallSettings.Builder<GetSavedQueryRequest, SavedQuery> getSavedQuerySettings() {
1590       return getSavedQuerySettings;
1591     }
1592 
1593     /** Returns the builder for the settings used for calls to listSavedQueries. */
1594     public PagedCallSettings.Builder<
1595             ListSavedQueriesRequest, ListSavedQueriesResponse, ListSavedQueriesPagedResponse>
listSavedQueriesSettings()1596         listSavedQueriesSettings() {
1597       return listSavedQueriesSettings;
1598     }
1599 
1600     /** Returns the builder for the settings used for calls to updateSavedQuery. */
1601     public UnaryCallSettings.Builder<UpdateSavedQueryRequest, SavedQuery>
updateSavedQuerySettings()1602         updateSavedQuerySettings() {
1603       return updateSavedQuerySettings;
1604     }
1605 
1606     /** Returns the builder for the settings used for calls to deleteSavedQuery. */
deleteSavedQuerySettings()1607     public UnaryCallSettings.Builder<DeleteSavedQueryRequest, Empty> deleteSavedQuerySettings() {
1608       return deleteSavedQuerySettings;
1609     }
1610 
1611     /** Returns the builder for the settings used for calls to batchGetEffectiveIamPolicies. */
1612     public UnaryCallSettings.Builder<
1613             BatchGetEffectiveIamPoliciesRequest, BatchGetEffectiveIamPoliciesResponse>
batchGetEffectiveIamPoliciesSettings()1614         batchGetEffectiveIamPoliciesSettings() {
1615       return batchGetEffectiveIamPoliciesSettings;
1616     }
1617 
1618     /** Returns the builder for the settings used for calls to analyzeOrgPolicies. */
1619     public PagedCallSettings.Builder<
1620             AnalyzeOrgPoliciesRequest, AnalyzeOrgPoliciesResponse, AnalyzeOrgPoliciesPagedResponse>
analyzeOrgPoliciesSettings()1621         analyzeOrgPoliciesSettings() {
1622       return analyzeOrgPoliciesSettings;
1623     }
1624 
1625     /**
1626      * Returns the builder for the settings used for calls to analyzeOrgPolicyGovernedContainers.
1627      */
1628     public PagedCallSettings.Builder<
1629             AnalyzeOrgPolicyGovernedContainersRequest,
1630             AnalyzeOrgPolicyGovernedContainersResponse,
1631             AnalyzeOrgPolicyGovernedContainersPagedResponse>
analyzeOrgPolicyGovernedContainersSettings()1632         analyzeOrgPolicyGovernedContainersSettings() {
1633       return analyzeOrgPolicyGovernedContainersSettings;
1634     }
1635 
1636     /** Returns the builder for the settings used for calls to analyzeOrgPolicyGovernedAssets. */
1637     public PagedCallSettings.Builder<
1638             AnalyzeOrgPolicyGovernedAssetsRequest,
1639             AnalyzeOrgPolicyGovernedAssetsResponse,
1640             AnalyzeOrgPolicyGovernedAssetsPagedResponse>
analyzeOrgPolicyGovernedAssetsSettings()1641         analyzeOrgPolicyGovernedAssetsSettings() {
1642       return analyzeOrgPolicyGovernedAssetsSettings;
1643     }
1644 
1645     @Override
build()1646     public AssetServiceStubSettings build() throws IOException {
1647       return new AssetServiceStubSettings(this);
1648     }
1649   }
1650 }
1651