From 81d832d56f594cf4c6b9dbc3f26df6dcfc86a6d2 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 1 Feb 2022 13:44:08 -0500 Subject: [PATCH 1/6] chore(main): release 2.7.2-SNAPSHOT (#1818) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- benchmark/pom.xml | 2 +- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/benchmark/pom.xml b/benchmark/pom.xml index 80e947d5c0..b1a8f6f3f4 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 2.7.1 + 2.7.2-SNAPSHOT diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index 011c2b8eb6..859c535ec8 100644 --- a/google-cloud-bigquery/pom.xml +++ b/google-cloud-bigquery/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigquery - 2.7.1 + 2.7.2-SNAPSHOT jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 2.7.1 + 2.7.2-SNAPSHOT google-cloud-bigquery diff --git a/pom.xml b/pom.xml index d4ac902e19..22491cbc48 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 2.7.1 + 2.7.2-SNAPSHOT BigQuery Parent https://github.com/googleapis/java-bigquery @@ -84,7 +84,7 @@ com.google.cloud google-cloud-bigquery - 2.7.1 + 2.7.2-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 7faba98a12..feca4fe7ef 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 2.7.1 + 2.7.2-SNAPSHOT diff --git a/versions.txt b/versions.txt index 81ff40aa6b..b7da590b2d 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:2.7.1:2.7.1 \ No newline at end of file +google-cloud-bigquery:2.7.1:2.7.2-SNAPSHOT \ No newline at end of file From 82175f19634550f8b16c830362798396cd28e79d Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 1 Feb 2022 23:58:43 +0100 Subject: [PATCH 2/6] deps: update dependency com.google.apis:google-api-services-bigquery to v2-rev20220123-1.32.1 (#1819) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.apis:google-api-services-bigquery](http://nexus.sonatype.org/oss-repository-hosting.html) ([source](http://svn.sonatype.org/spice/tags/oss-parent-7)) | `v2-rev20211129-1.32.1` -> `v2-rev20220123-1.32.1` | [![age](https://badges.renovateapi.com/packages/maven/com.google.apis:google-api-services-bigquery/v2-rev20220123-1.32.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.apis:google-api-services-bigquery/v2-rev20220123-1.32.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.apis:google-api-services-bigquery/v2-rev20220123-1.32.1/compatibility-slim/v2-rev20211129-1.32.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.apis:google-api-services-bigquery/v2-rev20220123-1.32.1/confidence-slim/v2-rev20211129-1.32.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-bigquery). --- README.md | 4 ++-- pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c4d97a1567..9d084caa07 100644 --- a/README.md +++ b/README.md @@ -59,13 +59,13 @@ implementation 'com.google.cloud:google-cloud-bigquery' If you are using Gradle without BOM, add this to your dependencies ```Groovy -implementation 'com.google.cloud:google-cloud-bigquery:2.7.0' +implementation 'com.google.cloud:google-cloud-bigquery:2.7.1' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.7.0" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.7.1" ``` ## Authentication diff --git a/pom.xml b/pom.xml index 22491cbc48..3dd3457284 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ UTF-8 github google-cloud-bigquery-parent - v2-rev20211129-1.32.1 + v2-rev20220123-1.32.1 2.7.0 From 8c50fb51bcb3116bf037c30997563b67ba077945 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 2 Feb 2022 16:04:41 +0100 Subject: [PATCH 3/6] chore(deps): update dependency com.google.cloud:google-cloud-bigquery to v2.7.1 (#1822) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-bigquery](https://togithub.com/googleapis/java-bigquery) | `2.7.0` -> `2.7.1` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-bigquery/2.7.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-bigquery/2.7.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-bigquery/2.7.1/compatibility-slim/2.7.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-bigquery/2.7.1/confidence-slim/2.7.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/java-bigquery ### [`v2.7.1`](https://togithub.com/googleapis/java-bigquery/blob/HEAD/CHANGELOG.md#​271-httpsgithubcomgoogleapisjava-bigquerycomparev270v271-2022-02-01) [Compare Source](https://togithub.com/googleapis/java-bigquery/compare/v2.7.0...v2.7.1)
--- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-bigquery). --- README.md | 2 +- samples/install-without-bom/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d084caa07..0b3f49656a 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ If you are using Maven without BOM, add this to your dependencies: com.google.cloud google-cloud-bigquery - 2.7.0 + 2.7.1 ``` diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index e19fa839dd..87ef5fb42b 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -45,7 +45,7 @@ com.google.cloud google-cloud-bigquery - 2.7.0 + 2.7.1 From 0fe0a78db110794f9d2797bd74792d361acef96c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 2 Feb 2022 16:04:46 +0100 Subject: [PATCH 4/6] deps: update dependency com.google.cloud:google-cloud-bigtable to v2.5.2 (#1821) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-bigtable](https://togithub.com/googleapis/java-bigtable) | `2.5.1` -> `2.5.2` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-bigtable/2.5.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-bigtable/2.5.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-bigtable/2.5.2/compatibility-slim/2.5.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-bigtable/2.5.2/confidence-slim/2.5.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/java-bigtable ### [`v2.5.2`](https://togithub.com/googleapis/java-bigtable/blob/HEAD/CHANGELOG.md#​252-httpsgithubcomgoogleapisjava-bigtablecomparev251v252-2022-01-31) [Compare Source](https://togithub.com/googleapis/java-bigtable/compare/v2.5.1...v2.5.2)
--- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-bigquery). --- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 87ef5fb42b..9cb96538f0 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -63,7 +63,7 @@ com.google.cloud google-cloud-bigtable - 2.5.1 + 2.5.2 test diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index feca4fe7ef..1b50734e3c 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -61,7 +61,7 @@ com.google.cloud google-cloud-bigtable - 2.5.1 + 2.5.2 test diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index ebc1260a63..1be592b879 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -79,7 +79,7 @@ com.google.cloud google-cloud-bigtable - 2.5.1 + 2.5.2 test From 18a11e88c0be5c0d5cf89d498439d5f8347e589d Mon Sep 17 00:00:00 2001 From: Stephanie Wang Date: Wed, 2 Feb 2022 11:47:12 -0500 Subject: [PATCH 5/6] feat: add Dataset ACL support (#1763) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add Dataset ACL support * some lint updates * add back interface that was causing IDE issues * fix recursive import issue * debug * update code based on pending discovery doc changes (cl/421673680) * update code to reflect more changes (target_types should be List) based on pending discovery doc changes (cl/421673680) * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * rename to address feedback Co-authored-by: Owl Bot --- .../java/com/google/cloud/bigquery/Acl.java | 89 +++++++++++++++++-- .../com/google/cloud/bigquery/AclTest.java | 14 +++ .../cloud/bigquery/SerializationTest.java | 9 +- .../cloud/bigquery/it/ITBigQueryTest.java | 42 +++++++++ 4 files changed, 144 insertions(+), 10 deletions(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Acl.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Acl.java index 48ff863420..115e001bd3 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Acl.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Acl.java @@ -20,9 +20,11 @@ import com.google.api.core.ApiFunction; import com.google.api.services.bigquery.model.Dataset.Access; +import com.google.api.services.bigquery.model.DatasetAccessEntry; import com.google.cloud.StringEnumType; import com.google.cloud.StringEnumValue; import java.io.Serializable; +import java.util.List; import java.util.Objects; /** @@ -105,7 +107,8 @@ public enum Type { USER, VIEW, IAM_MEMBER, - ROUTINE + ROUTINE, + DATASET } Entity(Type type) { @@ -119,6 +122,11 @@ public Type getType() { abstract Access toPb(); static Entity fromPb(Access access) { + if (access.getDataset() != null) { + return new DatasetAclEntity( + DatasetId.fromPb(access.getDataset().getDataset()), + access.getDataset().getTargetTypes()); + } if (access.getDomain() != null) { return new Domain(access.getDomain()); } @@ -146,6 +154,65 @@ static Entity fromPb(Access access) { } } + /** + * Class for a BigQuery DatasetAclEntity ACL entity. Objects of this class represent a + * DatasetAclEntity from a different DatasetAclEntity to grant access to. Only views are supported + * for now. The role field is not required when this field is set. If that DatasetAclEntity is + * deleted and re-created, its access needs to be granted again via an update operation. + */ + public static final class DatasetAclEntity extends Entity { + + private static final long serialVersionUID = -8392885851733136526L; + + private final DatasetId id; + private final List targetTypes; + + /** Creates a DatasetAclEntity given the DatasetAclEntity's id. */ + public DatasetAclEntity(DatasetId id, List targetTypes) { + super(Type.DATASET); + this.id = id; + this.targetTypes = targetTypes; + } + + /** Returns DatasetAclEntity's identity. */ + public DatasetId getId() { + return id; + } + + public List getTargetTypes() { + return targetTypes; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + DatasetAclEntity datasetAclEntity = (DatasetAclEntity) obj; + return Objects.equals(getType(), datasetAclEntity.getType()) + && Objects.equals(id, datasetAclEntity.id); + } + + @Override + public int hashCode() { + return Objects.hash(getType(), id); + } + + @Override + public String toString() { + return toPb().toString(); + } + + @Override + Access toPb() { + return new Access() + .setDataset(new DatasetAccessEntry().setDataset(id.toPb()).setTargetTypes(targetTypes)); + } + } + /** * Class for a BigQuery Domain entity. Objects of this class represent a domain to grant access * to. Any users signed in with the domain specified will be granted the specified access. @@ -342,9 +409,10 @@ Access toPb() { /** * Class for a BigQuery View entity. Objects of this class represent a view from a different - * dataset to grant access to. Queries executed against that view will have read access to tables - * in this dataset. The role field is not required when this field is set. If that view is updated - * by any user, access to the view needs to be granted again via an update operation. + * datasetAclEntity to grant access to. Queries executed against that view will have read access + * to tables in this datasetAclEntity. The role field is not required when this field is set. If + * that view is updated by any user, access to the view needs to be granted again via an update + * operation. */ public static final class View extends Entity { @@ -393,10 +461,10 @@ Access toPb() { /** * Class for a BigQuery Routine entity. Objects of this class represent a routine from a different - * dataset to grant access to. Queries executed against that routine will have read access to - * views/tables/routines in this dataset. Only UDF is supported for now. The role field is not - * required when this field is set. If that routine is updated by any user, access to the routine - * needs to be granted again via an update operation. + * datasetAclEntity to grant access to. Queries executed against that routine will have read + * access to views/tables/routines in this datasetAclEntity. Only UDF is supported for now. The + * role field is not required when this field is set. If that routine is updated by any user, + * access to the routine needs to be granted again via an update operation. */ public static final class Routine extends Entity { @@ -516,6 +584,11 @@ public static Acl of(Entity entity, Role role) { return new Acl(entity, role); } + /** Returns an Acl object for a datasetAclEntity. */ + public static Acl of(DatasetAclEntity datasetAclEntity) { + return new Acl(datasetAclEntity, null); + } + /** Returns an Acl object for a view entity. */ public static Acl of(View view) { return new Acl(view, null); diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/AclTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/AclTest.java index 7368033918..30866c2b60 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/AclTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/AclTest.java @@ -19,6 +19,7 @@ import static org.junit.Assert.assertEquals; import com.google.api.services.bigquery.model.Dataset; +import com.google.cloud.bigquery.Acl.DatasetAclEntity; import com.google.cloud.bigquery.Acl.Domain; import com.google.cloud.bigquery.Acl.Entity; import com.google.cloud.bigquery.Acl.Entity.Type; @@ -27,10 +28,23 @@ import com.google.cloud.bigquery.Acl.Role; import com.google.cloud.bigquery.Acl.User; import com.google.cloud.bigquery.Acl.View; +import com.google.common.collect.ImmutableList; +import java.util.List; import org.junit.Test; public class AclTest { + @Test + public void testDatasetEntity() { + DatasetId datasetId = DatasetId.of("dataset"); + List targetTypes = ImmutableList.of("VIEWS"); + DatasetAclEntity entity = new DatasetAclEntity(datasetId, targetTypes); + assertEquals(datasetId, entity.getId()); + assertEquals(targetTypes, entity.getTargetTypes()); + Dataset.Access pb = entity.toPb(); + assertEquals(entity, Entity.fromPb(pb)); + } + @Test public void testDomainEntity() { Domain entity = new Domain("d1"); diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/SerializationTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/SerializationTest.java index 30bb0db0b8..0b0cd0207a 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/SerializationTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/SerializationTest.java @@ -20,6 +20,7 @@ import com.google.cloud.NoCredentials; import com.google.cloud.PageImpl; import com.google.cloud.Restorable; +import com.google.cloud.bigquery.Acl.DatasetAclEntity; import com.google.cloud.bigquery.StandardTableDefinition.StreamingBuffer; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -38,8 +39,6 @@ public class SerializationTest extends BaseSerializationTest { Acl.of(new Acl.View(TableId.of("project", "dataset", "table")), Acl.Role.WRITER); private static final Acl ROUTINE_ACCESS = Acl.of(new Acl.Routine(RoutineId.of("project", "dataset", "routine")), Acl.Role.WRITER); - private static final List ACCESS_RULES = - ImmutableList.of(DOMAIN_ACCESS, GROUP_ACCESS, VIEW_ACCESS, ROUTINE_ACCESS, USER_ACCESS); private static final Long CREATION_TIME = System.currentTimeMillis() - 10; private static final Long DEFAULT_TABLE_EXPIRATION = 100L; private static final String DESCRIPTION = "Description"; @@ -50,6 +49,11 @@ public class SerializationTest extends BaseSerializationTest { private static final String LOCATION = ""; private static final String SELF_LINK = "http://bigquery/p/d"; private static final DatasetId DATASET_ID = DatasetId.of("project", "dataset"); + private static final List TARGET_TYPES = ImmutableList.of("VIEWS"); + private static final Acl DATASET_ACCESS = Acl.of(new DatasetAclEntity(DATASET_ID, TARGET_TYPES)); + private static final List ACCESS_RULES = + ImmutableList.of( + DOMAIN_ACCESS, GROUP_ACCESS, VIEW_ACCESS, ROUTINE_ACCESS, USER_ACCESS, DATASET_ACCESS); private static final DatasetInfo DATASET_INFO = DatasetInfo.newBuilder(DATASET_ID) .setAcl(ACCESS_RULES) @@ -228,6 +232,7 @@ protected Serializable[] serializableObjects() { USER_ACCESS, VIEW_ACCESS, ROUTINE_ACCESS, + DATASET_ACCESS, DATASET_ID, DATASET_INFO, TABLE_ID, diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java index 09c9b7a7b7..b8051122f7 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java @@ -38,6 +38,7 @@ import com.google.cloud.Role; import com.google.cloud.ServiceOptions; import com.google.cloud.bigquery.Acl; +import com.google.cloud.bigquery.Acl.DatasetAclEntity; import com.google.cloud.bigquery.BigQuery; import com.google.cloud.bigquery.BigQuery.DatasetDeleteOption; import com.google.cloud.bigquery.BigQuery.DatasetField; @@ -1897,6 +1898,47 @@ public void testAuthorizeRoutine() { assertEquals(routineAcl, routineDataset.getAcl()); } + @Test + public void testAuthorizeDataset() { + String datasetName = RemoteBigQueryHelper.generateDatasetName(); + DatasetId datasetId = DatasetId.of(PROJECT_ID, datasetName); + List targetTypes = ImmutableList.of("VIEWS"); + // Specify the acl which will be shared to the authorized dataset + List acl = + ImmutableList.of( + Acl.of(new Acl.Group("projectOwners"), Acl.Role.OWNER), + Acl.of(new Acl.IamMember("allUsers"), Acl.Role.READER)); + DatasetInfo datasetInfo = + DatasetInfo.newBuilder(datasetId).setAcl(acl).setDescription("shared Dataset").build(); + Dataset sharedDataset = bigquery.create(datasetInfo); + assertNotNull(sharedDataset); + assertEquals(sharedDataset.getDescription(), "shared Dataset"); + // Get the current metadata for the dataset you want to share by calling the datasets.get method + List sharedDatasetAcl = new ArrayList<>(sharedDataset.getAcl()); + + // Create a new dataset to be authorized + String authorizedDatasetName = RemoteBigQueryHelper.generateDatasetName(); + DatasetId authorizedDatasetId = DatasetId.of(PROJECT_ID, authorizedDatasetName); + DatasetInfo authorizedDatasetInfo = + DatasetInfo.newBuilder(authorizedDatasetId) + .setDescription("new Dataset to be authorized by the sharedDataset") + .build(); + Dataset authorizedDataset = bigquery.create(authorizedDatasetInfo); + assertNotNull(authorizedDataset); + assertEquals( + authorizedDataset.getDescription(), "new Dataset to be authorized by the sharedDataset"); + + // Add the new DatasetAccessEntry object to the existing sharedDatasetAcl list + DatasetAclEntity datasetEntity = new DatasetAclEntity(authorizedDatasetId, targetTypes); + sharedDatasetAcl.add(Acl.of(datasetEntity)); + + // Update the dataset with the added authorization + Dataset updatedDataset = sharedDataset.toBuilder().setAcl(sharedDatasetAcl).build().update(); + + // Verify that the authorized dataset has been added + assertEquals(sharedDatasetAcl, updatedDataset.getAcl()); + } + @Test public void testSingleStatementsQueryException() throws InterruptedException { String invalidQuery = From b3b8d174121da24b7305060cf23f5e85dddee9a4 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 2 Feb 2022 19:12:50 +0000 Subject: [PATCH 6/6] chore(main): release 2.8.0 (#1820) :robot: I have created a release *beep* *boop* --- ## [2.8.0](https://github.com/googleapis/java-bigquery/compare/v2.7.1...v2.8.0) (2022-02-02) ### Features * add Dataset ACL support ([#1763](https://github.com/googleapis/java-bigquery/issues/1763)) ([18a11e8](https://github.com/googleapis/java-bigquery/commit/18a11e88c0be5c0d5cf89d498439d5f8347e589d)) ### Dependencies * update dependency com.google.apis:google-api-services-bigquery to v2-rev20220123-1.32.1 ([#1819](https://github.com/googleapis/java-bigquery/issues/1819)) ([82175f1](https://github.com/googleapis/java-bigquery/commit/82175f19634550f8b16c830362798396cd28e79d)) * update dependency com.google.cloud:google-cloud-bigtable to v2.5.2 ([#1821](https://github.com/googleapis/java-bigquery/issues/1821)) ([0fe0a78](https://github.com/googleapis/java-bigquery/commit/0fe0a78db110794f9d2797bd74792d361acef96c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 13 +++++++++++++ benchmark/pom.xml | 2 +- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b34e2ec70..20c9d3e508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [2.8.0](https://github.com/googleapis/java-bigquery/compare/v2.7.1...v2.8.0) (2022-02-02) + + +### Features + +* add Dataset ACL support ([#1763](https://github.com/googleapis/java-bigquery/issues/1763)) ([18a11e8](https://github.com/googleapis/java-bigquery/commit/18a11e88c0be5c0d5cf89d498439d5f8347e589d)) + + +### Dependencies + +* update dependency com.google.apis:google-api-services-bigquery to v2-rev20220123-1.32.1 ([#1819](https://github.com/googleapis/java-bigquery/issues/1819)) ([82175f1](https://github.com/googleapis/java-bigquery/commit/82175f19634550f8b16c830362798396cd28e79d)) +* update dependency com.google.cloud:google-cloud-bigtable to v2.5.2 ([#1821](https://github.com/googleapis/java-bigquery/issues/1821)) ([0fe0a78](https://github.com/googleapis/java-bigquery/commit/0fe0a78db110794f9d2797bd74792d361acef96c)) + ### [2.7.1](https://github.com/googleapis/java-bigquery/compare/v2.7.0...v2.7.1) (2022-02-01) diff --git a/benchmark/pom.xml b/benchmark/pom.xml index b1a8f6f3f4..c20b9eb519 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 2.7.2-SNAPSHOT + 2.8.0 diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index 859c535ec8..5eee1ea2f9 100644 --- a/google-cloud-bigquery/pom.xml +++ b/google-cloud-bigquery/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigquery - 2.7.2-SNAPSHOT + 2.8.0 jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 2.7.2-SNAPSHOT + 2.8.0 google-cloud-bigquery diff --git a/pom.xml b/pom.xml index 3dd3457284..07ad8b6b72 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 2.7.2-SNAPSHOT + 2.8.0 BigQuery Parent https://github.com/googleapis/java-bigquery @@ -84,7 +84,7 @@ com.google.cloud google-cloud-bigquery - 2.7.2-SNAPSHOT + 2.8.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 1b50734e3c..143ca6acd0 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 2.7.2-SNAPSHOT + 2.8.0 diff --git a/versions.txt b/versions.txt index b7da590b2d..9e9df81f2e 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:2.7.1:2.7.2-SNAPSHOT \ No newline at end of file +google-cloud-bigquery:2.8.0:2.8.0 \ No newline at end of file