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

feat: Release of relationships in v1, Add content type Relationship to support relationship export #851

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -50,7 +50,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.9.0')
implementation platform('com.google.cloud:libraries-bom:21.0.0')

compile 'com.google.cloud:google-cloud-asset'
```
Expand Down
Expand Up @@ -54,6 +54,7 @@
* .addAllAssetNames(new ArrayList<String>())
* .setContentType(ContentType.forNumber(0))
* .setReadTimeWindow(TimeWindow.newBuilder().build())
* .addAllRelationshipTypes(new ArrayList<String>())
* .build();
* BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
* }
Expand Down Expand Up @@ -190,6 +191,7 @@ public final OperationsClient getOperationsClient() {
* .addAllAssetTypes(new ArrayList<String>())
* .setContentType(ContentType.forNumber(0))
* .setOutputConfig(OutputConfig.newBuilder().build())
* .addAllRelationshipTypes(new ArrayList<String>())
* .build();
* ExportAssetsResponse response = assetServiceClient.exportAssetsAsync(request).get();
* }
Expand Down Expand Up @@ -225,6 +227,7 @@ public final OperationFuture<ExportAssetsResponse, ExportAssetsRequest> exportAs
* .addAllAssetTypes(new ArrayList<String>())
* .setContentType(ContentType.forNumber(0))
* .setOutputConfig(OutputConfig.newBuilder().build())
* .addAllRelationshipTypes(new ArrayList<String>())
* .build();
* OperationFuture<ExportAssetsResponse, ExportAssetsRequest> future =
* assetServiceClient.exportAssetsOperationCallable().futureCall(request);
Expand Down Expand Up @@ -260,6 +263,7 @@ public final OperationFuture<ExportAssetsResponse, ExportAssetsRequest> exportAs
* .addAllAssetTypes(new ArrayList<String>())
* .setContentType(ContentType.forNumber(0))
* .setOutputConfig(OutputConfig.newBuilder().build())
* .addAllRelationshipTypes(new ArrayList<String>())
* .build();
* ApiFuture<Operation> future = assetServiceClient.exportAssetsCallable().futureCall(request);
* // Do something.
Expand Down Expand Up @@ -340,6 +344,7 @@ public final ListAssetsPagedResponse listAssets(String parent) {
* .setContentType(ContentType.forNumber(0))
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .addAllRelationshipTypes(new ArrayList<String>())
* .build();
* for (Asset element : assetServiceClient.listAssets(request).iterateAll()) {
* // doThingsWith(element);
Expand Down Expand Up @@ -370,6 +375,7 @@ public final ListAssetsPagedResponse listAssets(ListAssetsRequest request) {
* .setContentType(ContentType.forNumber(0))
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .addAllRelationshipTypes(new ArrayList<String>())
* .build();
* ApiFuture<Asset> future = assetServiceClient.listAssetsPagedCallable().futureCall(request);
* // Do something.
Expand Down Expand Up @@ -399,6 +405,7 @@ public final UnaryCallable<ListAssetsRequest, ListAssetsPagedResponse> listAsset
* .setContentType(ContentType.forNumber(0))
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .addAllRelationshipTypes(new ArrayList<String>())
* .build();
* while (true) {
* ListAssetsResponse response = assetServiceClient.listAssetsCallable().call(request);
Expand Down Expand Up @@ -437,6 +444,7 @@ public final UnaryCallable<ListAssetsRequest, ListAssetsResponse> listAssetsCall
* .addAllAssetNames(new ArrayList<String>())
* .setContentType(ContentType.forNumber(0))
* .setReadTimeWindow(TimeWindow.newBuilder().build())
* .addAllRelationshipTypes(new ArrayList<String>())
* .build();
* BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
* }
Expand Down Expand Up @@ -468,6 +476,7 @@ public final BatchGetAssetsHistoryResponse batchGetAssetsHistory(
* .addAllAssetNames(new ArrayList<String>())
* .setContentType(ContentType.forNumber(0))
* .setReadTimeWindow(TimeWindow.newBuilder().build())
* .addAllRelationshipTypes(new ArrayList<String>())
* .build();
* ApiFuture<BatchGetAssetsHistoryResponse> future =
* assetServiceClient.batchGetAssetsHistoryCallable().futureCall(request);
Expand Down
Expand Up @@ -27,10 +27,11 @@
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* BatchGetAssetsHistoryRequest request =
* BatchGetAssetsHistoryRequest.newBuilder()
* .setParent(ProjectName.of("[PROJECT]").toString())
* .setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
* .addAllAssetNames(new ArrayList<String>())
* .setContentType(ContentType.forNumber(0))
* .setReadTimeWindow(TimeWindow.newBuilder().build())
* .addAllRelationshipTypes(new ArrayList<String>())
* .build();
* BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
* }
Expand Down
Expand Up @@ -27,7 +27,7 @@
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* ExportAssetsRequest request =
* ExportAssetsRequest.newBuilder()
* .setParent(ProjectName.of("[PROJECT]").toString())
* .setParent(BillingAccountName.of("[BILLING_ACCOUNT]").toString())
* .setReadTime(Timestamp.newBuilder().build())
* .addAllAssetTypes(new ArrayList<String>())
* .setContentType(ContentType.forNumber(0))
Expand Down
Expand Up @@ -113,6 +113,7 @@ public void exportAssetsTest() throws Exception {
.addAllAssetTypes(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setOutputConfig(OutputConfig.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();

ExportAssetsResponse actualResponse = client.exportAssetsAsync(request).get();
Expand All @@ -127,6 +128,8 @@ public void exportAssetsTest() throws Exception {
Assert.assertEquals(request.getAssetTypesList(), actualRequest.getAssetTypesList());
Assert.assertEquals(request.getContentType(), actualRequest.getContentType());
Assert.assertEquals(request.getOutputConfig(), actualRequest.getOutputConfig());
Assert.assertEquals(
request.getRelationshipTypesList(), actualRequest.getRelationshipTypesList());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
Expand All @@ -146,6 +149,7 @@ public void exportAssetsExceptionTest() throws Exception {
.addAllAssetTypes(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setOutputConfig(OutputConfig.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
client.exportAssetsAsync(request).get();
Assert.fail("No exception raised");
Expand Down Expand Up @@ -258,6 +262,7 @@ public void batchGetAssetsHistoryTest() throws Exception {
.addAllAssetNames(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setReadTimeWindow(TimeWindow.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();

BatchGetAssetsHistoryResponse actualResponse = client.batchGetAssetsHistory(request);
Expand All @@ -272,6 +277,8 @@ public void batchGetAssetsHistoryTest() throws Exception {
Assert.assertEquals(request.getAssetNamesList(), actualRequest.getAssetNamesList());
Assert.assertEquals(request.getContentType(), actualRequest.getContentType());
Assert.assertEquals(request.getReadTimeWindow(), actualRequest.getReadTimeWindow());
Assert.assertEquals(
request.getRelationshipTypesList(), actualRequest.getRelationshipTypesList());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
Expand All @@ -290,6 +297,7 @@ public void batchGetAssetsHistoryExceptionTest() throws Exception {
.addAllAssetNames(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setReadTimeWindow(TimeWindow.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
client.batchGetAssetsHistory(request);
Assert.fail("No exception raised");
Expand All @@ -308,6 +316,7 @@ public void createFeedTest() throws Exception {
.setContentType(ContentType.forNumber(0))
.setFeedOutputConfig(FeedOutputConfig.newBuilder().build())
.setCondition(Expr.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
mockAssetService.addResponse(expectedResponse);

Expand Down Expand Up @@ -351,6 +360,7 @@ public void getFeedTest() throws Exception {
.setContentType(ContentType.forNumber(0))
.setFeedOutputConfig(FeedOutputConfig.newBuilder().build())
.setCondition(Expr.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
mockAssetService.addResponse(expectedResponse);

Expand Down Expand Up @@ -394,6 +404,7 @@ public void getFeedTest2() throws Exception {
.setContentType(ContentType.forNumber(0))
.setFeedOutputConfig(FeedOutputConfig.newBuilder().build())
.setCondition(Expr.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
mockAssetService.addResponse(expectedResponse);

Expand Down Expand Up @@ -473,6 +484,7 @@ public void updateFeedTest() throws Exception {
.setContentType(ContentType.forNumber(0))
.setFeedOutputConfig(FeedOutputConfig.newBuilder().build())
.setCondition(Expr.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
mockAssetService.addResponse(expectedResponse);

Expand Down
Expand Up @@ -126,7 +126,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>.google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
Expand All @@ -142,7 +142,7 @@ public boolean hasCreateTime() {
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>.google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
Expand All @@ -158,7 +158,7 @@ public com.google.protobuf.Timestamp getCreateTime() {
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>.google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
Expand Down Expand Up @@ -514,7 +514,7 @@ public Builder mergeFrom(
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>
Expand All @@ -530,7 +530,7 @@ public boolean hasCreateTime() {
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>
Expand All @@ -552,7 +552,7 @@ public com.google.protobuf.Timestamp getCreateTime() {
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>
Expand All @@ -576,7 +576,7 @@ public Builder setCreateTime(com.google.protobuf.Timestamp value) {
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>
Expand All @@ -597,7 +597,7 @@ public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForVal
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>
Expand All @@ -623,7 +623,7 @@ public Builder mergeCreateTime(com.google.protobuf.Timestamp value) {
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>
Expand All @@ -645,7 +645,7 @@ public Builder clearCreateTime() {
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>
Expand All @@ -661,7 +661,7 @@ public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() {
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>
Expand All @@ -681,7 +681,7 @@ public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() {
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>
Expand Down
Expand Up @@ -27,7 +27,7 @@ public interface AnalyzeIamPolicyLongrunningMetadataOrBuilder
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>.google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
Expand All @@ -40,7 +40,7 @@ public interface AnalyzeIamPolicyLongrunningMetadataOrBuilder
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>.google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
Expand All @@ -53,7 +53,7 @@ public interface AnalyzeIamPolicyLongrunningMetadataOrBuilder
*
*
* <pre>
* The time the operation was created.
* Output only. The time the operation was created.
* </pre>
*
* <code>.google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
Expand Down