Skip to content

Commit 38d0f69

Browse files
committed
---
yaml --- r: 1849 b: refs/heads/pubsub-alpha c: 3fc189b h: refs/heads/master i: 1847: 69bed01
1 parent fcc4d85 commit 38d0f69

6 files changed

Lines changed: 77 additions & 26 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ refs/heads/master: 689bbb466df4b2d5d2483d6edb8ac5c7c7f7c6fa
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
6-
refs/heads/pubsub-alpha: e4a5e5597b90db73907235abfac3cf123b011c58
6+
refs/heads/pubsub-alpha: 3fc189bbad20e177fcdc9592089357c79d25c2d0
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
88
refs/heads/update-datastore: 482954f2c5055231e5b3122ea91d2ba00ce8187c
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/Acl.java

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222
import java.util.Objects;
2323

2424
/**
25-
* Access Control for a BigQuery Dataset.
25+
* Access Control for a BigQuery Dataset. BigQuery uses ACLs to manage permissions on datasets. ACLs
26+
* are not directly supported on tables. A table inherits its ACL from the dataset that contains it.
27+
* Project roles affect your ability to run jobs or manage the project, while dataset roles affect
28+
* how you can access or modify the data inside of a project.
29+
*
30+
* @see <a href="https://cloud.google.com/bigquery/access-control">Access Control</a>
2631
*/
2732
public final class Acl implements Serializable {
2833

@@ -31,16 +36,38 @@ public final class Acl implements Serializable {
3136
private final Entity entity;
3237
private final Role role;
3338

39+
/**
40+
* Dataset roles supported by BigQuery.
41+
*
42+
* @see <a href="https://cloud.google.com/bigquery/access-control#datasetroles">Dataset Roles</a>
43+
*/
3444
public enum Role {
35-
OWNER, READER, WRITER
45+
/**
46+
* Can read, query, copy or export tables in the dataset.
47+
*/
48+
READER,
49+
/**
50+
* Same as {@link #READER} plus can edit or append data in the dataset.
51+
*/
52+
WRITER,
53+
/**
54+
* Same as {@link #WRITER} plus can update and delete the dataset.
55+
*/
56+
OWNER
3657
}
3758

59+
/**
60+
* Base class for BigQuery entities that can be grant access to the dataset.
61+
*/
3862
public static abstract class Entity implements Serializable {
3963

4064
private static final long serialVersionUID = 8111776788607959944L;
4165

4266
private final Type type;
4367

68+
/**
69+
* Types of BigQuery entities.
70+
*/
4471
public enum Type {
4572
DOMAIN, GROUP, USER, VIEW
4673
}
@@ -78,7 +105,8 @@ static Entity fromPb(Access access) {
78105
}
79106

80107
/**
81-
* Class for a BigQuery Domain entity.
108+
* Class for a BigQuery Domain entity. Objects of this class represent a domain to grant access
109+
* to. Any users signed in with the domain specified will be granted the specified access.
82110
*/
83111
public static final class Domain extends Entity {
84112

@@ -131,7 +159,10 @@ Access toPb() {
131159
}
132160

133161
/**
134-
* Class for a BigQuery Group entity.
162+
* Class for a BigQuery Group entity. Objects of this class represent a group to grante access to.
163+
* A Group entity can be created given the group's email or can be a special group:
164+
* {@link #ofProjectOwners()}, {@link #ofProjectReaders()}, {@link #ofProjectWriters()} or
165+
* {@link #ofAllAuthenticatedUsers()}.
135166
*/
136167
public static final class Group extends Entity {
137168

@@ -144,19 +175,19 @@ public static final class Group extends Entity {
144175
private final String identifier;
145176

146177
/**
147-
* Creates a Group entity given its identifier. Identifier can be either a special group
148-
* identifier ({@code projectOwners}, {@code projectReaders}, {@code projectWriters} and
149-
* {@code allAuthenticatedUsers}) or a group email.
178+
* Creates a Group entity given its identifier. Identifier can be either a
179+
* <a href="https://cloud.google.com/bigquery/docs/reference/v2/datasets#access.specialGroup">
180+
* special group identifier</a> or a group email.
150181
*/
151182
public Group(String identifier) {
152183
super(Type.GROUP);
153184
this.identifier = identifier;
154185
}
155186

156187
/**
157-
* Returns group's identifier, can be either a special group identifier ({@code projectOwners},
158-
* {@code projectReaders}, {@code projectWriters} and {@code allAuthenticatedUsers}) or a group
159-
* email.
188+
* Returns group's identifier, can be either a
189+
* <a href="https://cloud.google.com/bigquery/docs/reference/v2/datasets#access.specialGroup">
190+
* special group identifier</a> or a group email.
160191
*/
161192
public String identifier() {
162193
return identifier;
@@ -196,9 +227,8 @@ Access toPb() {
196227
case ALL_AUTHENTICATED_USERS:
197228
return new Access().setSpecialGroup(ALL_AUTHENTICATED_USERS);
198229
default:
199-
break;
230+
return new Access().setGroupByEmail(identifier);
200231
}
201-
return new Access().setGroupByEmail(identifier);
202232
}
203233

204234
/**
@@ -223,15 +253,16 @@ public static Group ofProjectWriters() {
223253
}
224254

225255
/**
226-
* Returns a Group entity representing all project's users.
256+
* Returns a Group entity representing all BigQuery authenticated users.
227257
*/
228258
public static Group ofAllAuthenticatedUsers() {
229259
return new Group(ALL_AUTHENTICATED_USERS);
230260
}
231261
}
232262

233263
/**
234-
* Class for a BigQuery User entity.
264+
* Class for a BigQuery User entity. Objects of this class represent a user to grant access to
265+
* given the email address.
235266
*/
236267
public static final class User extends Entity {
237268

@@ -283,7 +314,10 @@ Access toPb() {
283314
}
284315

285316
/**
286-
* Class for a BigQuery View entity.
317+
* Class for a BigQuery View entity. Objects of this class represent a view from a different
318+
* dataset to grant access to. Queries executed against that view will have read access to tables
319+
* in this dataset. The role field is not required when this field is set. If that view is updated
320+
* by any user, access to the view needs to be granted again via an update operation.
287321
*/
288322
public static final class View extends Entity {
289323

@@ -298,7 +332,7 @@ public View(TableId id) {
298332
}
299333

300334
/**
301-
* Returns table's email.
335+
* Returns table's identity.
302336
*/
303337
public TableId id() {
304338
return id;

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/DatasetId.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616

1717
package com.google.gcloud.bigquery;
1818

19-
import com.google.api.services.bigquery.model.DatasetReference;
2019
import static com.google.common.base.Preconditions.checkNotNull;
2120

21+
import com.google.api.services.bigquery.model.DatasetReference;
22+
2223
import java.io.Serializable;
2324
import java.util.Objects;
2425

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/DatasetInfo.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
import java.util.Objects;
3232

3333
/**
34-
* Google BigQuery Dataset information.
34+
* Google BigQuery Dataset information. A dataset is a grouping mechanism that holds zero or more
35+
* tables. Datasets are the lowest level unit of access control; you cannot control access at the
36+
* table level.
3537
*
3638
* @see <a href="https://cloud.google.com/bigquery/docs/managing_jobs_datasets_projects#datasets">
3739
* Managing Jobs, Datasets, and Projects</a>
@@ -128,7 +130,8 @@ Builder creationTime(Long creationTime) {
128130
* expirationTime for a given table is reached, that table will be deleted automatically. If a
129131
* table's expirationTime is modified or removed before the table expires, or if you provide an
130132
* explicit expirationTime when creating a table, that value takes precedence over the default
131-
* expiration time indicated by this property.
133+
* expiration time indicated by this property. This property is experimental and might be
134+
* subject to change or removed.
132135
*/
133136
public Builder defaultTableLifetime(Long defaultTableLifetime) {
134137
this.defaultTableLifetime =
@@ -168,10 +171,11 @@ Builder lastModified(Long lastModified) {
168171
}
169172

170173
/**
171-
* Sets the geographic location where the dataset should reside.
174+
* Sets the geographic location where the dataset should reside. This property is experimental
175+
* and might be subject to change or removed.
172176
*
173-
* @see <a href="https://cloud.google.com/bigquery/docs/managing_jobs_datasets_projects#dataset-location">
174-
* Dataset Location</a>
177+
* @see <a href="https://cloud.google.com/bigquery/docs/reference/v2/datasets#location">Dataset
178+
* Location</a>
175179
*/
176180
public Builder location(String location) {
177181
this.location = firstNonNull(location, Data.<String>nullOf(String.class));
@@ -306,7 +310,15 @@ public Builder toBuilder() {
306310
public String toString() {
307311
return MoreObjects.toStringHelper(this)
308312
.add("datasetId", datasetId)
313+
.add("creationTime", creationTime)
314+
.add("defaultTableLifetime", defaultTableLifetime)
309315
.add("description", description)
316+
.add("etag", etag)
317+
.add("friendlyName", friendlyName)
318+
.add("id", id)
319+
.add("lastModified", lastModified)
320+
.add("location", location)
321+
.add("selfLink", selfLink)
310322
.add("acl", acl)
311323
.toString();
312324
}

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableId.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
package com.google.gcloud.bigquery;
1818

19+
import static com.google.common.base.Preconditions.checkNotNull;
20+
1921
import com.google.api.services.bigquery.model.TableReference;
2022
import com.google.common.base.Function;
2123

22-
import static com.google.common.base.Preconditions.checkNotNull;
23-
2424
import java.io.Serializable;
2525
import java.util.Objects;
2626

branches/pubsub-alpha/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/DatasetInfoTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ public void testToBuilder() {
6868
assertEquals("description2", datasetInfo.description());
6969
datasetInfo = datasetInfo.toBuilder().datasetId(DATASET_ID).description("description").build();
7070
compareDatasets(DATASET_INFO, datasetInfo);
71-
datasetInfo = DatasetInfo.builder(DATASET_ID).build();
71+
}
72+
73+
@Test
74+
public void testToBuilderIncomplete() {
75+
DatasetInfo datasetInfo = DatasetInfo.builder(DATASET_ID).build();
7276
assertEquals(datasetInfo, datasetInfo.toBuilder().build());
7377
}
7478

0 commit comments

Comments
 (0)