Skip to content
Permalink
Browse files
docs: generate sample code in the Java microgenerator (#540)
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/0ae55182-06f0-43ed-98b1-1c835bf4b2f1/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 356341083
Source-Link: googleapis/googleapis@8d8c008
  • Loading branch information
yoshi-automation committed Feb 16, 2021
1 parent c4f7672 commit 4dbc2e9ae7d23469686f4d0cc20f90530c8109a3

Large diffs are not rendered by default.

@@ -22,6 +22,18 @@
* <p>Service Description: Asset service definition.
*
* <p>Sample for AssetServiceClient:
*
* <pre>{@code
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* BatchGetAssetsHistoryRequest request =
* BatchGetAssetsHistoryRequest.newBuilder()
* .setParent(ProjectName.of("[PROJECT]").toString())
* .addAllAssetNames(new ArrayList<String>())
* .setReadTimeWindow(TimeWindow.newBuilder().build())
* .build();
* BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
* }
* }</pre>
*/
@Generated("by gapic-generator-java")
package com.google.cloud.asset.v1;
@@ -41,6 +41,18 @@
* <p>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:
*
* <pre>{@code
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* String scope = "scope109264468";
* String query = "query107944136";
* List<String> assetTypes = new ArrayList<>();
* for (StandardResourceMetadata element :
* assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* <p>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.
*
* <p>Sample code:
*
* <pre>{@code
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* String scope = "scope109264468";
* String query = "query107944136";
* List<String> assetTypes = new ArrayList<>();
* for (StandardResourceMetadata element :
* assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param scope Required. The relative name of an asset. The search is limited to the resources
* within the `scope`. The allowed value must be:
* <ul>
@@ -181,6 +207,26 @@ public final SearchAllResourcesPagedResponse searchAllResources(
* cloud.assets.SearchAllResources permission on the requested scope, otherwise it will be
* rejected.
*
* <p>Sample code:
*
* <pre>{@code
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* SearchAllResourcesRequest request =
* SearchAllResourcesRequest.newBuilder()
* .setScope("scope109264468")
* .setQuery("query107944136")
* .addAllAssetTypes(new ArrayList<String>())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setOrderBy("orderBy-1207110587")
* .build();
* for (StandardResourceMetadata element :
* assetServiceClient.searchAllResources(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @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.
*
* <p>Sample code:
*
* <pre>{@code
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* SearchAllResourcesRequest request =
* SearchAllResourcesRequest.newBuilder()
* .setScope("scope109264468")
* .setQuery("query107944136")
* .addAllAssetTypes(new ArrayList<String>())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setOrderBy("orderBy-1207110587")
* .build();
* ApiFuture<StandardResourceMetadata> future =
* assetServiceClient.searchAllResourcesPagedCallable().futureCall(request);
* // Do something.
* for (StandardResourceMetadata element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*/
public final UnaryCallable<SearchAllResourcesRequest, SearchAllResourcesPagedResponse>
searchAllResourcesPagedCallable() {
@@ -213,6 +279,24 @@ public final SearchAllResourcesPagedResponse searchAllResources(
* rejected.
*
* <p>Sample code:
*
* <pre>{@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;
* }
* }
* }
* }</pre>
*/
public final UnaryCallable<SearchAllResourcesRequest, SearchAllResourcesResponse>
searchAllResourcesCallable() {
@@ -227,6 +311,19 @@ public final SearchAllResourcesPagedResponse searchAllResources(
* have cloud.assets.SearchAllIamPolicies permission on the requested scope, otherwise it will be
* rejected.
*
* <p>Sample code:
*
* <pre>{@code
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* String scope = "scope109264468";
* String query = "query107944136";
* for (IamPolicySearchResult element :
* assetServiceClient.searchAllIamPolicies(scope, query).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param scope Required. The relative name of an asset. The search is limited to the resources
* within the `scope`. The allowed value must be:
* <ul>
@@ -258,6 +355,24 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(String scope
* have cloud.assets.SearchAllIamPolicies permission on the requested scope, otherwise it will be
* rejected.
*
* <p>Sample code:
*
* <pre>{@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);
* }
* }
* }</pre>
*
* @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.
*
* <p>Sample code:
*
* <pre>{@code
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* SearchAllIamPoliciesRequest request =
* SearchAllIamPoliciesRequest.newBuilder()
* .setScope("scope109264468")
* .setQuery("query107944136")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture<IamPolicySearchResult> future =
* assetServiceClient.searchAllIamPoliciesPagedCallable().futureCall(request);
* // Do something.
* for (IamPolicySearchResult element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*/
public final UnaryCallable<SearchAllIamPoliciesRequest, SearchAllIamPoliciesPagedResponse>
searchAllIamPoliciesPagedCallable() {
@@ -290,6 +423,24 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(
* rejected.
*
* <p>Sample code:
*
* <pre>{@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;
* }
* }
* }
* }</pre>
*/
public final UnaryCallable<SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse>
searchAllIamPoliciesCallable() {
@@ -22,6 +22,18 @@
* <p>Service Description: Asset service definition.
*
* <p>Sample for AssetServiceClient:
*
* <pre>{@code
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* String scope = "scope109264468";
* String query = "query107944136";
* List<String> assetTypes = new ArrayList<>();
* for (StandardResourceMetadata element :
* assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*/
@Generated("by gapic-generator-java")
package com.google.cloud.asset.v1p1beta1;

0 comments on commit 4dbc2e9

Please sign in to comment.