Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

CloudAsset: Update asset lib to v1 for ListAssets sample code #760

Merged
merged 10 commits into from
Aug 9, 2021
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ If you are using Maven without BOM, add this to your dependencies:

If you are using Gradle 5.x or later, add this to your dependencies
```Groovy
implementation platform('com.google.cloud:libraries-bom:20.8.0')
implementation platform('com.google.cloud:libraries-bom:20.9.0')

compile 'com.google.cloud:google-cloud-asset'
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@

package com.example.asset;

// [START asset_quickstart_list_assets]
// Imports the Google Cloud client library

import com.google.cloud.asset.v1.AssetServiceClient;
import com.google.cloud.asset.v1.AssetServiceClient.ListAssetsPagedResponse;
import com.google.cloud.asset.v1.ContentType;
import com.google.cloud.asset.v1.ListAssetsRequest;
import com.google.cloud.asset.v1.ProjectName;
import com.google.cloud.asset.v1p5beta1.AssetServiceClient;
import com.google.cloud.asset.v1p5beta1.AssetServiceClient.ListAssetsPagedResponse;
import com.google.cloud.asset.v1p5beta1.ContentType;
import com.google.cloud.asset.v1p5beta1.ListAssetsRequest;
import java.util.Arrays;

// [START asset_quickstart_list_assets]
peter-zheng-g marked this conversation as resolved.
Show resolved Hide resolved
// Imports the Google Cloud client library

public class ListAssetsExample {

public static void listAssets() throws Exception {
Expand All @@ -38,7 +38,7 @@ public static void listAssets() throws Exception {
String[] assetTypes = {"YOUR_ASSET_TYPES_TO_LIST"};
// The asset content type to list. E.g., ContentType.CONTENT_TYPE_UNSPECIFIED.
// See full list of content types at
// https://cloud.google.com/asset-inventory/docs/reference/rpc/google.cloud.asset.v1p5beta1#contenttype
// https://cloud.google.com/asset-inventory/docs/reference/rpc/google.cloud.asset.v1#contenttype
ContentType contentType = ContentType.CONTENT_TYPE_UNSPECIFIED;
listAssets(projectId, assetTypes, contentType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static com.google.common.truth.Truth.assertThat;

import com.google.cloud.ServiceOptions;
import com.google.cloud.asset.v1p5beta1.ContentType;
import com.google.cloud.asset.v1.ContentType;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import org.junit.After;
Expand Down