1616
1717package com .google .cloud .asset .v1 .stub ;
1818
19+ import static com .google .cloud .asset .v1 .AssetServiceClient .ListAssetsPagedResponse ;
1920import static com .google .cloud .asset .v1 .AssetServiceClient .SearchAllIamPoliciesPagedResponse ;
2021import static com .google .cloud .asset .v1 .AssetServiceClient .SearchAllResourcesPagedResponse ;
2122
4950import com .google .cloud .asset .v1 .AnalyzeIamPolicyLongrunningResponse ;
5051import com .google .cloud .asset .v1 .AnalyzeIamPolicyRequest ;
5152import com .google .cloud .asset .v1 .AnalyzeIamPolicyResponse ;
53+ import com .google .cloud .asset .v1 .Asset ;
5254import com .google .cloud .asset .v1 .BatchGetAssetsHistoryRequest ;
5355import com .google .cloud .asset .v1 .BatchGetAssetsHistoryResponse ;
5456import com .google .cloud .asset .v1 .CreateFeedRequest ;
5860import com .google .cloud .asset .v1 .Feed ;
5961import com .google .cloud .asset .v1 .GetFeedRequest ;
6062import com .google .cloud .asset .v1 .IamPolicySearchResult ;
63+ import com .google .cloud .asset .v1 .ListAssetsRequest ;
64+ import com .google .cloud .asset .v1 .ListAssetsResponse ;
6165import com .google .cloud .asset .v1 .ListFeedsRequest ;
6266import com .google .cloud .asset .v1 .ListFeedsResponse ;
6367import com .google .cloud .asset .v1 .ResourceSearchResult ;
@@ -119,6 +123,8 @@ public class AssetServiceStubSettings extends StubSettings<AssetServiceStubSetti
119123 private final OperationCallSettings <
120124 ExportAssetsRequest , ExportAssetsResponse , ExportAssetsRequest >
121125 exportAssetsOperationSettings ;
126+ private final PagedCallSettings <ListAssetsRequest , ListAssetsResponse , ListAssetsPagedResponse >
127+ listAssetsSettings ;
122128 private final UnaryCallSettings <BatchGetAssetsHistoryRequest , BatchGetAssetsHistoryResponse >
123129 batchGetAssetsHistorySettings ;
124130 private final UnaryCallSettings <CreateFeedRequest , Feed > createFeedSettings ;
@@ -144,6 +150,42 @@ public class AssetServiceStubSettings extends StubSettings<AssetServiceStubSetti
144150 AnalyzeIamPolicyLongrunningRequest >
145151 analyzeIamPolicyLongrunningOperationSettings ;
146152
153+ private static final PagedListDescriptor <ListAssetsRequest , ListAssetsResponse , Asset >
154+ LIST_ASSETS_PAGE_STR_DESC =
155+ new PagedListDescriptor <ListAssetsRequest , ListAssetsResponse , Asset >() {
156+ @ Override
157+ public String emptyToken () {
158+ return "" ;
159+ }
160+
161+ @ Override
162+ public ListAssetsRequest injectToken (ListAssetsRequest payload , String token ) {
163+ return ListAssetsRequest .newBuilder (payload ).setPageToken (token ).build ();
164+ }
165+
166+ @ Override
167+ public ListAssetsRequest injectPageSize (ListAssetsRequest payload , int pageSize ) {
168+ return ListAssetsRequest .newBuilder (payload ).setPageSize (pageSize ).build ();
169+ }
170+
171+ @ Override
172+ public Integer extractPageSize (ListAssetsRequest payload ) {
173+ return payload .getPageSize ();
174+ }
175+
176+ @ Override
177+ public String extractNextToken (ListAssetsResponse payload ) {
178+ return payload .getNextPageToken ();
179+ }
180+
181+ @ Override
182+ public Iterable <Asset > extractResources (ListAssetsResponse payload ) {
183+ return payload .getAssetsList () == null
184+ ? ImmutableList .<Asset >of ()
185+ : payload .getAssetsList ();
186+ }
187+ };
188+
147189 private static final PagedListDescriptor <
148190 SearchAllResourcesRequest , SearchAllResourcesResponse , ResourceSearchResult >
149191 SEARCH_ALL_RESOURCES_PAGE_STR_DESC =
@@ -226,6 +268,23 @@ public Iterable<IamPolicySearchResult> extractResources(
226268 }
227269 };
228270
271+ private static final PagedListResponseFactory <
272+ ListAssetsRequest , ListAssetsResponse , ListAssetsPagedResponse >
273+ LIST_ASSETS_PAGE_STR_FACT =
274+ new PagedListResponseFactory <
275+ ListAssetsRequest , ListAssetsResponse , ListAssetsPagedResponse >() {
276+ @ Override
277+ public ApiFuture <ListAssetsPagedResponse > getFuturePagedResponse (
278+ UnaryCallable <ListAssetsRequest , ListAssetsResponse > callable ,
279+ ListAssetsRequest request ,
280+ ApiCallContext context ,
281+ ApiFuture <ListAssetsResponse > futureResponse ) {
282+ PageContext <ListAssetsRequest , ListAssetsResponse , Asset > pageContext =
283+ PageContext .create (callable , LIST_ASSETS_PAGE_STR_DESC , request , context );
284+ return ListAssetsPagedResponse .createAsync (pageContext , futureResponse );
285+ }
286+ };
287+
229288 private static final PagedListResponseFactory <
230289 SearchAllResourcesRequest , SearchAllResourcesResponse , SearchAllResourcesPagedResponse >
231290 SEARCH_ALL_RESOURCES_PAGE_STR_FACT =
@@ -285,6 +344,12 @@ public UnaryCallSettings<ExportAssetsRequest, Operation> exportAssetsSettings()
285344 return exportAssetsOperationSettings ;
286345 }
287346
347+ /** Returns the object with the settings used for calls to listAssets. */
348+ public PagedCallSettings <ListAssetsRequest , ListAssetsResponse , ListAssetsPagedResponse >
349+ listAssetsSettings () {
350+ return listAssetsSettings ;
351+ }
352+
288353 /** Returns the object with the settings used for calls to batchGetAssetsHistory. */
289354 public UnaryCallSettings <BatchGetAssetsHistoryRequest , BatchGetAssetsHistoryResponse >
290355 batchGetAssetsHistorySettings () {
@@ -424,6 +489,7 @@ protected AssetServiceStubSettings(Builder settingsBuilder) throws IOException {
424489
425490 exportAssetsSettings = settingsBuilder .exportAssetsSettings ().build ();
426491 exportAssetsOperationSettings = settingsBuilder .exportAssetsOperationSettings ().build ();
492+ listAssetsSettings = settingsBuilder .listAssetsSettings ().build ();
427493 batchGetAssetsHistorySettings = settingsBuilder .batchGetAssetsHistorySettings ().build ();
428494 createFeedSettings = settingsBuilder .createFeedSettings ().build ();
429495 getFeedSettings = settingsBuilder .getFeedSettings ().build ();
@@ -446,6 +512,9 @@ public static class Builder extends StubSettings.Builder<AssetServiceStubSetting
446512 private final OperationCallSettings .Builder <
447513 ExportAssetsRequest , ExportAssetsResponse , ExportAssetsRequest >
448514 exportAssetsOperationSettings ;
515+ private final PagedCallSettings .Builder <
516+ ListAssetsRequest , ListAssetsResponse , ListAssetsPagedResponse >
517+ listAssetsSettings ;
449518 private final UnaryCallSettings .Builder <
450519 BatchGetAssetsHistoryRequest , BatchGetAssetsHistoryResponse >
451520 batchGetAssetsHistorySettings ;
@@ -553,6 +622,7 @@ protected Builder(ClientContext clientContext) {
553622
554623 exportAssetsSettings = UnaryCallSettings .newUnaryCallSettingsBuilder ();
555624 exportAssetsOperationSettings = OperationCallSettings .newBuilder ();
625+ listAssetsSettings = PagedCallSettings .newBuilder (LIST_ASSETS_PAGE_STR_FACT );
556626 batchGetAssetsHistorySettings = UnaryCallSettings .newUnaryCallSettingsBuilder ();
557627 createFeedSettings = UnaryCallSettings .newUnaryCallSettingsBuilder ();
558628 getFeedSettings = UnaryCallSettings .newUnaryCallSettingsBuilder ();
@@ -569,6 +639,7 @@ protected Builder(ClientContext clientContext) {
569639 unaryMethodSettingsBuilders =
570640 ImmutableList .<UnaryCallSettings .Builder <?, ?>>of (
571641 exportAssetsSettings ,
642+ listAssetsSettings ,
572643 batchGetAssetsHistorySettings ,
573644 createFeedSettings ,
574645 getFeedSettings ,
@@ -587,6 +658,7 @@ protected Builder(AssetServiceStubSettings settings) {
587658
588659 exportAssetsSettings = settings .exportAssetsSettings .toBuilder ();
589660 exportAssetsOperationSettings = settings .exportAssetsOperationSettings .toBuilder ();
661+ listAssetsSettings = settings .listAssetsSettings .toBuilder ();
590662 batchGetAssetsHistorySettings = settings .batchGetAssetsHistorySettings .toBuilder ();
591663 createFeedSettings = settings .createFeedSettings .toBuilder ();
592664 getFeedSettings = settings .getFeedSettings .toBuilder ();
@@ -604,6 +676,7 @@ protected Builder(AssetServiceStubSettings settings) {
604676 unaryMethodSettingsBuilders =
605677 ImmutableList .<UnaryCallSettings .Builder <?, ?>>of (
606678 exportAssetsSettings ,
679+ listAssetsSettings ,
607680 batchGetAssetsHistorySettings ,
608681 createFeedSettings ,
609682 getFeedSettings ,
@@ -633,6 +706,11 @@ private static Builder initDefaults(Builder builder) {
633706 .setRetryableCodes (RETRYABLE_CODE_DEFINITIONS .get ("no_retry_0_codes" ))
634707 .setRetrySettings (RETRY_PARAM_DEFINITIONS .get ("no_retry_0_params" ));
635708
709+ builder
710+ .listAssetsSettings ()
711+ .setRetryableCodes (RETRYABLE_CODE_DEFINITIONS .get ("retry_policy_1_codes" ))
712+ .setRetrySettings (RETRY_PARAM_DEFINITIONS .get ("retry_policy_1_params" ));
713+
636714 builder
637715 .batchGetAssetsHistorySettings ()
638716 .setRetryableCodes (RETRYABLE_CODE_DEFINITIONS .get ("retry_policy_1_codes" ))
@@ -767,6 +845,12 @@ public UnaryCallSettings.Builder<ExportAssetsRequest, Operation> exportAssetsSet
767845 return exportAssetsOperationSettings ;
768846 }
769847
848+ /** Returns the builder for the settings used for calls to listAssets. */
849+ public PagedCallSettings .Builder <ListAssetsRequest , ListAssetsResponse , ListAssetsPagedResponse >
850+ listAssetsSettings () {
851+ return listAssetsSettings ;
852+ }
853+
770854 /** Returns the builder for the settings used for calls to batchGetAssetsHistory. */
771855 public UnaryCallSettings .Builder <BatchGetAssetsHistoryRequest , BatchGetAssetsHistoryResponse >
772856 batchGetAssetsHistorySettings () {
0 commit comments