-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(bigquery): support IAM conditions in datasets #11123
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can check inside the Create/Update/Metadata
methods if the dataset has any AccessEntry
with a non nil
Condition
and automatically add the AccessPolicyVersion = 3
, without requiring to add the new *WithOptions
methods and DatasetOption
for now.
One thing that I'm concerned is if users starts to use IAM conditions and have a mixed set of Datasets
with and without conditions, they have to change all of their code to adopt the new *WithOptions
methods and check by themselves if the dataset has conditions or not to add the proper WithAccessPolicyVersion
version. Calling the Metadata
call might be the most common one that would cause more confusions.
Maybe the Dataset
struct has a method like hasConditions
where if checks for AccessEntry.Condition
and on the Create/Update/Metadata
methods we check that and add the version.
bigquery/dataset.go
Outdated
|
||
// Expr represents the conditional information related to dataset access policies. | ||
type Expr struct { | ||
//Textual representation of an expression in Common Expression Language syntax. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing space here after //
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per internal discussion, it's better for users to be explicit about integrating with IAM conditions, so makes sense to have the *WIthOptions
methods. When they start adopting this feature, they can use Policy version 3 for all of they dataset access usage.
This PR adds support for IAM conditions via the existing dataset access mechanism. To do so, the following changes are necessary:
Expr
type for expressing conditions, and wire it into the existing DatasetAccessEntry.To expose the new functionality, this PR adds CreateWithOptions, UpdateWithOptions, MetadataWithOptions methods on Dataset that accept the new option.