diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java index 08abe777d..bc1752136 100644 --- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java @@ -46,6 +46,18 @@ *
This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * BatchGetAssetsHistoryRequest request = + * BatchGetAssetsHistoryRequest.newBuilder() + * .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .addAllAssetNames(new ArrayList+ * *()) + * .setReadTimeWindow(TimeWindow.newBuilder().build()) + * .build(); + * BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request); + * } + * }
Note: close() needs to be called on the AssetServiceClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -166,6 +178,21 @@ public final OperationsClient getOperationsClient() { * exponential retry to poll the export operation result. For regular-size resource parent, the * export operation usually finishes within 5 minutes. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ExportAssetsRequest request = + * ExportAssetsRequest.newBuilder() + * .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .setReadTime(Timestamp.newBuilder().build()) + * .addAllAssetTypes(new ArrayList+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -186,6 +213,22 @@ public final OperationFuture()) + * .setOutputConfig(OutputConfig.newBuilder().build()) + * .build(); + * ExportAssetsResponse response = assetServiceClient.exportAssetsAsync(request).get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ExportAssetsRequest request = + * ExportAssetsRequest.newBuilder() + * .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .setReadTime(Timestamp.newBuilder().build()) + * .addAllAssetTypes(new ArrayList*/ public final OperationCallable()) + * .setOutputConfig(OutputConfig.newBuilder().build()) + * .build(); + * OperationFuture future = + * assetServiceClient.exportAssetsOperationCallable().futureCall(request); + * // Do something. + * ExportAssetsResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ExportAssetsRequest request = + * ExportAssetsRequest.newBuilder() + * .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .setReadTime(Timestamp.newBuilder().build()) + * .addAllAssetTypes(new ArrayList*/ public final UnaryCallable()) + * .setOutputConfig(OutputConfig.newBuilder().build()) + * .build(); + * ApiFuture future = assetServiceClient.exportAssetsCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * BatchGetAssetsHistoryRequest request = + * BatchGetAssetsHistoryRequest.newBuilder() + * .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .addAllAssetNames(new ArrayList+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -234,6 +306,21 @@ public final BatchGetAssetsHistoryResponse batchGetAssetsHistory( * error. * *()) + * .setReadTimeWindow(TimeWindow.newBuilder().build()) + * .build(); + * BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * BatchGetAssetsHistoryRequest request = + * BatchGetAssetsHistoryRequest.newBuilder() + * .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .addAllAssetNames(new ArrayList*/ public final UnaryCallable()) + * .setReadTimeWindow(TimeWindow.newBuilder().build()) + * .build(); + * ApiFuture future = + * assetServiceClient.batchGetAssetsHistoryCallable().futureCall(request); + * // Do something. + * BatchGetAssetsHistoryResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String parent = "parent-995424086"; + * Feed response = assetServiceClient.createFeed(parent); + * } + * }+ * * @param parent Required. The name of the project/folder/organization where this feed should be * created in. It can only be an organization number (such as "organizations/123"), a folder * number (such as "folders/123"), a project ID (such as "projects/my-project-id")", or a @@ -259,6 +355,20 @@ public final Feed createFeed(String parent) { /** * Creates a feed in a parent project/folder/organization to listen to its asset updates. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * CreateFeedRequest request = + * CreateFeedRequest.newBuilder() + * .setParent("parent-995424086") + * .setFeedId("feedId-1278410919") + * .setFeed(Feed.newBuilder().build()) + * .build(); + * Feed response = assetServiceClient.createFeed(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -271,6 +381,20 @@ public final Feed createFeed(CreateFeedRequest request) { * Creates a feed in a parent project/folder/organization to listen to its asset updates. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * CreateFeedRequest request = + * CreateFeedRequest.newBuilder() + * .setParent("parent-995424086") + * .setFeedId("feedId-1278410919") + * .setFeed(Feed.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = assetServiceClient.createFeedCallable().futureCall(request); + * // Do something. + * Feed response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]"); + * Feed response = assetServiceClient.getFeed(name); + * } + * }+ * * @param name Required. The name of the Feed and it must be in the format of: * projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id * organizations/organization_number/feeds/feed_id @@ -295,6 +428,15 @@ public final Feed getFeed(FeedName name) { /** * Gets details about an asset feed. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString(); + * Feed response = assetServiceClient.getFeed(name); + * } + * }+ * * @param name Required. The name of the Feed and it must be in the format of: * projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id * organizations/organization_number/feeds/feed_id @@ -309,6 +451,18 @@ public final Feed getFeed(String name) { /** * Gets details about an asset feed. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * GetFeedRequest request = + * GetFeedRequest.newBuilder() + * .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .build(); + * Feed response = assetServiceClient.getFeed(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -321,6 +475,18 @@ public final Feed getFeed(GetFeedRequest request) { * Gets details about an asset feed. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * GetFeedRequest request = + * GetFeedRequest.newBuilder() + * .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = assetServiceClient.getFeedCallable().futureCall(request); + * // Do something. + * Feed response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String parent = "parent-995424086"; + * ListFeedsResponse response = assetServiceClient.listFeeds(parent); + * } + * }+ * * @param parent Required. The parent project/folder/organization whose feeds are to be listed. It * can only be using project/folder/organization number (such as "folders/12345")", or a * project ID (such as "projects/my-project-id"). @@ -344,6 +519,16 @@ public final ListFeedsResponse listFeeds(String parent) { /** * Lists all asset feeds in a parent project/folder/organization. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ListFeedsRequest request = + * ListFeedsRequest.newBuilder().setParent("parent-995424086").build(); + * ListFeedsResponse response = assetServiceClient.listFeeds(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -356,6 +541,17 @@ public final ListFeedsResponse listFeeds(ListFeedsRequest request) { * Lists all asset feeds in a parent project/folder/organization. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ListFeedsRequest request = + * ListFeedsRequest.newBuilder().setParent("parent-995424086").build(); + * ApiFuture*/ public final UnaryCallablefuture = + * assetServiceClient.listFeedsCallable().futureCall(request); + * // Do something. + * ListFeedsResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * Feed feed = Feed.newBuilder().build(); + * Feed response = assetServiceClient.updateFeed(feed); + * } + * }+ * * @param feed Required. The new values of feed details. It must match an existing feed and the * field `name` must be in the format of: projects/project_number/feeds/feed_id or * folders/folder_number/feeds/feed_id or organizations/organization_number/feeds/feed_id. @@ -379,6 +584,19 @@ public final Feed updateFeed(Feed feed) { /** * Updates an asset feed configuration. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * UpdateFeedRequest request = + * UpdateFeedRequest.newBuilder() + * .setFeed(Feed.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Feed response = assetServiceClient.updateFeed(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -391,6 +609,19 @@ public final Feed updateFeed(UpdateFeedRequest request) { * Updates an asset feed configuration. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * UpdateFeedRequest request = + * UpdateFeedRequest.newBuilder() + * .setFeed(Feed.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = assetServiceClient.updateFeedCallable().futureCall(request); + * // Do something. + * Feed response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]"); + * assetServiceClient.deleteFeed(name); + * } + * }+ * * @param name Required. The name of the feed and it must be in the format of: * projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id * organizations/organization_number/feeds/feed_id @@ -415,6 +655,15 @@ public final void deleteFeed(FeedName name) { /** * Deletes an asset feed. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString(); + * assetServiceClient.deleteFeed(name); + * } + * }+ * * @param name Required. The name of the feed and it must be in the format of: * projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id * organizations/organization_number/feeds/feed_id @@ -429,6 +678,18 @@ public final void deleteFeed(String name) { /** * Deletes an asset feed. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * DeleteFeedRequest request = + * DeleteFeedRequest.newBuilder() + * .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .build(); + * assetServiceClient.deleteFeed(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -441,6 +702,18 @@ public final void deleteFeed(DeleteFeedRequest request) { * Deletes an asset feed. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * DeleteFeedRequest request = + * DeleteFeedRequest.newBuilder() + * .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = assetServiceClient.deleteFeedCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String scope = "scope109264468"; + * String query = "query107944136"; + * List+ * * @param scope Required. A scope can be a project, a folder, or an organization. The search is * limited to the resources within the `scope`. The caller must be granted the * [`cloudasset.assets.searchAllResources`](http://cloud.google.com/asset-inventory/docs/access-control#required_permissions) @@ -518,6 +805,26 @@ public final SearchAllResourcesPagedResponse searchAllResources( * organization. The caller must be granted the `cloudasset.assets.searchAllResources` permission * on the desired scope, otherwise the request will be rejected. * + *assetTypes = new ArrayList<>(); + * for (ResourceSearchResult element : + * assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * SearchAllResourcesRequest request = + * SearchAllResourcesRequest.newBuilder() + * .setScope("scope109264468") + * .setQuery("query107944136") + * .addAllAssetTypes(new ArrayList+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -533,6 +840,26 @@ public final SearchAllResourcesPagedResponse searchAllResources( * on the desired scope, otherwise the request will be rejected. * *()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (ResourceSearchResult element : + * assetServiceClient.searchAllResources(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * SearchAllResourcesRequest request = + * SearchAllResourcesRequest.newBuilder() + * .setScope("scope109264468") + * .setQuery("query107944136") + * .addAllAssetTypes(new ArrayList*/ public final UnaryCallable()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture future = + * assetServiceClient.searchAllResourcesPagedCallable().futureCall(request); + * // Do something. + * for (ResourceSearchResult element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * while (true) { + * SearchAllResourcesResponse response = + * assetServiceClient.searchAllResourcesCallable().call(request); + * for (ResourceSearchResult element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String scope = "scope109264468"; + * String query = "query107944136"; + * for (IamPolicySearchResult element : + * assetServiceClient.searchAllIamPolicies(scope, query).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param scope Required. A scope can be a project, a folder, or an organization. The search is * limited to the IAM policies within the `scope`. The caller must be granted the * [`cloudasset.assets.searchAllIamPolicies`](http://cloud.google.com/asset-inventory/docs/access-control#required_permissions) @@ -608,6 +966,24 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(String scope * organization. The caller must be granted the `cloudasset.assets.searchAllIamPolicies` * permission on the desired scope, otherwise the request will be rejected. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * SearchAllIamPoliciesRequest request = + * SearchAllIamPoliciesRequest.newBuilder() + * .setScope("scope109264468") + * .setQuery("query107944136") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (IamPolicySearchResult element : + * assetServiceClient.searchAllIamPolicies(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -623,6 +999,24 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies( * permission on the desired scope, otherwise the request will be rejected. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * SearchAllIamPoliciesRequest request = + * SearchAllIamPoliciesRequest.newBuilder() + * .setScope("scope109264468") + * .setQuery("query107944136") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * assetServiceClient.searchAllIamPoliciesPagedCallable().futureCall(request); + * // Do something. + * for (IamPolicySearchResult element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * while (true) { + * SearchAllIamPoliciesResponse response = + * assetServiceClient.searchAllIamPoliciesCallable().call(request); + * for (IamPolicySearchResult element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * AnalyzeIamPolicyRequest request = + * AnalyzeIamPolicyRequest.newBuilder() + * .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build()) + * .setExecutionTimeout(Duration.newBuilder().build()) + * .build(); + * AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -658,6 +1083,20 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r * Analyzes IAM policies to answer which identities have what accesses on which resources. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * AnalyzeIamPolicyRequest request = + * AnalyzeIamPolicyRequest.newBuilder() + * .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build()) + * .setExecutionTimeout(Duration.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * assetServiceClient.analyzeIamPolicyCallable().futureCall(request); + * // Do something. + * AnalyzeIamPolicyResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * AnalyzeIamPolicyLongrunningRequest request = + * AnalyzeIamPolicyLongrunningRequest.newBuilder() + * .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build()) + * .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build()) + * .build(); + * AnalyzeIamPolicyLongrunningResponse response = + * assetServiceClient.analyzeIamPolicyLongrunningAsync(request).get(); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -696,6 +1149,21 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r * to map responses to requests. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * AnalyzeIamPolicyLongrunningRequest request = + * AnalyzeIamPolicyLongrunningRequest.newBuilder() + * .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build()) + * .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build()) + * .build(); + * OperationFuture*/ public final OperationCallable< AnalyzeIamPolicyLongrunningRequest, @@ -717,6 +1185,20 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r * to map responses to requests. * *+ * future = + * assetServiceClient.analyzeIamPolicyLongrunningOperationCallable().futureCall(request); + * // Do something. + * AnalyzeIamPolicyLongrunningResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * AnalyzeIamPolicyLongrunningRequest request = + * AnalyzeIamPolicyLongrunningRequest.newBuilder() + * .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build()) + * .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * assetServiceClient.analyzeIamPolicyLongrunningCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Service Description: Asset service definition. * *
Sample for AssetServiceClient: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * BatchGetAssetsHistoryRequest request = + * BatchGetAssetsHistoryRequest.newBuilder() + * .setParent(ProjectName.of("[PROJECT]").toString()) + * .addAllAssetNames(new ArrayList*/ @Generated("by gapic-generator-java") package com.google.cloud.asset.v1; diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceClient.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceClient.java index b46ebfd01..d9c031a10 100644 --- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceClient.java +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceClient.java @@ -41,6 +41,18 @@ *()) + * .setReadTimeWindow(TimeWindow.newBuilder().build()) + * .build(); + * BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request); + * } + * }
This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String scope = "scope109264468"; + * String query = "query107944136"; + * List+ * *assetTypes = new ArrayList<>(); + * for (StandardResourceMetadata element : + * assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Note: close() needs to be called on the AssetServiceClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -148,6 +160,20 @@ public AssetServiceStub getStub() { * cloud.assets.SearchAllResources permission on the requested scope, otherwise it will be * rejected. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String scope = "scope109264468"; + * String query = "query107944136"; + * List+ * * @param scope Required. The relative name of an asset. The search is limited to the resources * within the `scope`. The allowed value must be: *assetTypes = new ArrayList<>(); + * for (StandardResourceMetadata element : + * assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * SearchAllResourcesRequest request = + * SearchAllResourcesRequest.newBuilder() + * .setScope("scope109264468") + * .setQuery("query107944136") + * .addAllAssetTypes(new ArrayList+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -198,6 +244,26 @@ public final SearchAllResourcesPagedResponse searchAllResources( * rejected. * *()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (StandardResourceMetadata element : + * assetServiceClient.searchAllResources(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * SearchAllResourcesRequest request = + * SearchAllResourcesRequest.newBuilder() + * .setScope("scope109264468") + * .setQuery("query107944136") + * .addAllAssetTypes(new ArrayList*/ public final UnaryCallable()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture future = + * assetServiceClient.searchAllResourcesPagedCallable().futureCall(request); + * // Do something. + * for (StandardResourceMetadata element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * while (true) { + * SearchAllResourcesResponse response = + * assetServiceClient.searchAllResourcesCallable().call(request); + * for (StandardResourceMetadata element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String scope = "scope109264468"; + * String query = "query107944136"; + * for (IamPolicySearchResult element : + * assetServiceClient.searchAllIamPolicies(scope, query).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param scope Required. The relative name of an asset. The search is limited to the resources * within the `scope`. The allowed value must be: *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * SearchAllIamPoliciesRequest request = + * SearchAllIamPoliciesRequest.newBuilder() + * .setScope("scope109264468") + * .setQuery("query107944136") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (IamPolicySearchResult element : + * assetServiceClient.searchAllIamPolicies(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -275,6 +390,24 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies( * rejected. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * SearchAllIamPoliciesRequest request = + * SearchAllIamPoliciesRequest.newBuilder() + * .setScope("scope109264468") + * .setQuery("query107944136") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * assetServiceClient.searchAllIamPoliciesPagedCallable().futureCall(request); + * // Do something. + * for (IamPolicySearchResult element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * while (true) { + * SearchAllIamPoliciesResponse response = + * assetServiceClient.searchAllIamPoliciesCallable().call(request); + * for (IamPolicySearchResult element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Service Description: Asset service definition. * *
Sample for AssetServiceClient: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String scope = "scope109264468"; + * String query = "query107944136"; + * List*/ @Generated("by gapic-generator-java") package com.google.cloud.asset.v1p1beta1; diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/AssetServiceClient.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/AssetServiceClient.java index 20863a34f..d190cb945 100644 --- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/AssetServiceClient.java +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/AssetServiceClient.java @@ -33,6 +33,13 @@ *assetTypes = new ArrayList<>(); + * for (StandardResourceMetadata element : + * assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String parent = "parent-995424086"; + * Feed response = assetServiceClient.createFeed(parent); + * } + * }+ * *
Note: close() needs to be called on the AssetServiceClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -136,6 +143,15 @@ public AssetServiceStub getStub() { /** * Creates a feed in a parent project/folder/organization to listen to its asset updates. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String parent = "parent-995424086"; + * Feed response = assetServiceClient.createFeed(parent); + * } + * }+ * * @param parent Required. The name of the project/folder/organization where this feed should be * created in. It can only be an organization number (such as "organizations/123"), a folder * number (such as "folders/123"), a project ID (such as "projects/my-project-id")", or a @@ -151,6 +167,20 @@ public final Feed createFeed(String parent) { /** * Creates a feed in a parent project/folder/organization to listen to its asset updates. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * CreateFeedRequest request = + * CreateFeedRequest.newBuilder() + * .setParent("parent-995424086") + * .setFeedId("feedId-1278410919") + * .setFeed(Feed.newBuilder().build()) + * .build(); + * Feed response = assetServiceClient.createFeed(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -163,6 +193,20 @@ public final Feed createFeed(CreateFeedRequest request) { * Creates a feed in a parent project/folder/organization to listen to its asset updates. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * CreateFeedRequest request = + * CreateFeedRequest.newBuilder() + * .setParent("parent-995424086") + * .setFeedId("feedId-1278410919") + * .setFeed(Feed.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = assetServiceClient.createFeedCallable().futureCall(request); + * // Do something. + * Feed response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]"); + * Feed response = assetServiceClient.getFeed(name); + * } + * }+ * * @param name Required. The name of the Feed and it must be in the format of: * projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id * organizations/organization_number/feeds/feed_id @@ -187,6 +240,15 @@ public final Feed getFeed(FeedName name) { /** * Gets details about an asset feed. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString(); + * Feed response = assetServiceClient.getFeed(name); + * } + * }+ * * @param name Required. The name of the Feed and it must be in the format of: * projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id * organizations/organization_number/feeds/feed_id @@ -201,6 +263,18 @@ public final Feed getFeed(String name) { /** * Gets details about an asset feed. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * GetFeedRequest request = + * GetFeedRequest.newBuilder() + * .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .build(); + * Feed response = assetServiceClient.getFeed(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -213,6 +287,18 @@ public final Feed getFeed(GetFeedRequest request) { * Gets details about an asset feed. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * GetFeedRequest request = + * GetFeedRequest.newBuilder() + * .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = assetServiceClient.getFeedCallable().futureCall(request); + * // Do something. + * Feed response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String parent = "parent-995424086"; + * ListFeedsResponse response = assetServiceClient.listFeeds(parent); + * } + * }+ * * @param parent Required. The parent project/folder/organization whose feeds are to be listed. It * can only be using project/folder/organization number (such as "folders/12345")", or a * project ID (such as "projects/my-project-id"). @@ -236,6 +331,16 @@ public final ListFeedsResponse listFeeds(String parent) { /** * Lists all asset feeds in a parent project/folder/organization. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ListFeedsRequest request = + * ListFeedsRequest.newBuilder().setParent("parent-995424086").build(); + * ListFeedsResponse response = assetServiceClient.listFeeds(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -248,6 +353,17 @@ public final ListFeedsResponse listFeeds(ListFeedsRequest request) { * Lists all asset feeds in a parent project/folder/organization. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ListFeedsRequest request = + * ListFeedsRequest.newBuilder().setParent("parent-995424086").build(); + * ApiFuture*/ public final UnaryCallablefuture = + * assetServiceClient.listFeedsCallable().futureCall(request); + * // Do something. + * ListFeedsResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * Feed feed = Feed.newBuilder().build(); + * Feed response = assetServiceClient.updateFeed(feed); + * } + * }+ * * @param feed Required. The new values of feed details. It must match an existing feed and the * field `name` must be in the format of: projects/project_number/feeds/feed_id or * folders/folder_number/feeds/feed_id or organizations/organization_number/feeds/feed_id. @@ -271,6 +396,19 @@ public final Feed updateFeed(Feed feed) { /** * Updates an asset feed configuration. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * UpdateFeedRequest request = + * UpdateFeedRequest.newBuilder() + * .setFeed(Feed.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Feed response = assetServiceClient.updateFeed(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -283,6 +421,19 @@ public final Feed updateFeed(UpdateFeedRequest request) { * Updates an asset feed configuration. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * UpdateFeedRequest request = + * UpdateFeedRequest.newBuilder() + * .setFeed(Feed.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = assetServiceClient.updateFeedCallable().futureCall(request); + * // Do something. + * Feed response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]"); + * assetServiceClient.deleteFeed(name); + * } + * }+ * * @param name Required. The name of the feed and it must be in the format of: * projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id * organizations/organization_number/feeds/feed_id @@ -307,6 +467,15 @@ public final void deleteFeed(FeedName name) { /** * Deletes an asset feed. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString(); + * assetServiceClient.deleteFeed(name); + * } + * }+ * * @param name Required. The name of the feed and it must be in the format of: * projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id * organizations/organization_number/feeds/feed_id @@ -321,6 +490,18 @@ public final void deleteFeed(String name) { /** * Deletes an asset feed. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * DeleteFeedRequest request = + * DeleteFeedRequest.newBuilder() + * .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .build(); + * assetServiceClient.deleteFeed(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -333,6 +514,18 @@ public final void deleteFeed(DeleteFeedRequest request) { * Deletes an asset feed. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * DeleteFeedRequest request = + * DeleteFeedRequest.newBuilder() + * .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = assetServiceClient.deleteFeedCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Service Description: Asset service definition. * *
Sample for AssetServiceClient: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * String parent = "parent-995424086"; + * Feed response = assetServiceClient.createFeed(parent); + * } + * }*/ @Generated("by gapic-generator-java") package com.google.cloud.asset.v1p2beta1; diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/AssetServiceClient.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/AssetServiceClient.java index 94e4b7d12..8c08c5ebe 100644 --- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/AssetServiceClient.java +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/AssetServiceClient.java @@ -36,6 +36,17 @@ *
This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * AnalyzeIamPolicyRequest request = + * AnalyzeIamPolicyRequest.newBuilder() + * .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build()) + * .setOptions(AnalyzeIamPolicyRequest.Options.newBuilder().build()) + * .build(); + * AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request); + * } + * }+ * *
Note: close() needs to be called on the AssetServiceClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -152,6 +163,19 @@ public final OperationsClient getOperationsClient() { * [IamPolicyAnalysisResult][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult] matching the * request. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * AnalyzeIamPolicyRequest request = + * AnalyzeIamPolicyRequest.newBuilder() + * .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build()) + * .setOptions(AnalyzeIamPolicyRequest.Options.newBuilder().build()) + * .build(); + * AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -166,6 +190,20 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r * request. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * AnalyzeIamPolicyRequest request = + * AnalyzeIamPolicyRequest.newBuilder() + * .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build()) + * .setOptions(AnalyzeIamPolicyRequest.Options.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * assetServiceClient.analyzeIamPolicyCallable().futureCall(request); + * // Do something. + * AnalyzeIamPolicyResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ExportIamPolicyAnalysisRequest request = + * ExportIamPolicyAnalysisRequest.newBuilder() + * .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build()) + * .setOptions(ExportIamPolicyAnalysisRequest.Options.newBuilder().build()) + * .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build()) + * .build(); + * ExportIamPolicyAnalysisResponse response = + * assetServiceClient.exportIamPolicyAnalysisAsync(request).get(); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -193,6 +246,21 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r * the export. The metadata contains the request to help callers to map responses to requests. * *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ExportIamPolicyAnalysisRequest request = + * ExportIamPolicyAnalysisRequest.newBuilder() + * .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build()) + * .setOptions(ExportIamPolicyAnalysisRequest.Options.newBuilder().build()) + * .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build()) + * .build(); + * OperationFuture*/ public final OperationCallable< ExportIamPolicyAnalysisRequest, @@ -209,6 +277,21 @@ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest r * the export. The metadata contains the request to help callers to map responses to requests. * *future = + * assetServiceClient.exportIamPolicyAnalysisOperationCallable().futureCall(request); + * // Do something. + * ExportIamPolicyAnalysisResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ExportIamPolicyAnalysisRequest request = + * ExportIamPolicyAnalysisRequest.newBuilder() + * .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build()) + * .setOptions(ExportIamPolicyAnalysisRequest.Options.newBuilder().build()) + * .setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * assetServiceClient.exportIamPolicyAnalysisCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Service Description: Asset service definition. * *
Sample for AssetServiceClient: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * AnalyzeIamPolicyRequest request = + * AnalyzeIamPolicyRequest.newBuilder() + * .setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build()) + * .setOptions(AnalyzeIamPolicyRequest.Options.newBuilder().build()) + * .build(); + * AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request); + * } + * }*/ @Generated("by gapic-generator-java") package com.google.cloud.asset.v1p4beta1; diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p5beta1/AssetServiceClient.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p5beta1/AssetServiceClient.java index 4195826b4..22aba80c9 100644 --- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p5beta1/AssetServiceClient.java +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p5beta1/AssetServiceClient.java @@ -41,6 +41,22 @@ *
This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ListAssetsRequest request = + * ListAssetsRequest.newBuilder() + * .setParent("parent-995424086") + * .setReadTime(Timestamp.newBuilder().build()) + * .addAllAssetTypes(new ArrayList+ * *()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Asset element : assetServiceClient.listAssets(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Note: close() needs to be called on the AssetServiceClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -144,6 +160,24 @@ public AssetServiceStub getStub() { /** * Lists assets with time and resource types and returns paged results in response. * + *
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ListAssetsRequest request = + * ListAssetsRequest.newBuilder() + * .setParent("parent-995424086") + * .setReadTime(Timestamp.newBuilder().build()) + * .addAllAssetTypes(new ArrayList+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -156,6 +190,24 @@ public final ListAssetsPagedResponse listAssets(ListAssetsRequest request) { * Lists assets with time and resource types and returns paged results in response. * *()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Asset element : assetServiceClient.listAssets(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ListAssetsRequest request = + * ListAssetsRequest.newBuilder() + * .setParent("parent-995424086") + * .setReadTime(Timestamp.newBuilder().build()) + * .addAllAssetTypes(new ArrayList*/ public final UnaryCallable()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture future = assetServiceClient.listAssetsPagedCallable().futureCall(request); + * // Do something. + * for (Asset element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * while (true) { + * ListAssetsResponse response = assetServiceClient.listAssetsCallable().call(request); + * for (Asset element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Service Description: Asset service definition. * *
Sample for AssetServiceClient: + * + *
{@code + * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { + * ListAssetsRequest request = + * ListAssetsRequest.newBuilder() + * .setParent("parent-995424086") + * .setReadTime(Timestamp.newBuilder().build()) + * .addAllAssetTypes(new ArrayList*/ @Generated("by gapic-generator-java") package com.google.cloud.asset.v1p5beta1; diff --git a/synth.metadata b/synth.metadata index fdf3b2d3d..1498cf493 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,40 +11,40 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Asset element : assetServiceClient.listAssets(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }