Skip to content
Prev Previous commit
Next Next commit
lint pass
  • Loading branch information
shollyman committed Nov 13, 2024
commit 57c109dc894bc5466c24a1bad26c5bb2345f4c61
19 changes: 17 additions & 2 deletions bigquery/dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,21 @@ type dsCallOption struct {
// service.
type DatasetOption func(*dsCallOption)

// WithAccessPolicyVersion is an option that enabled setting of the Access Policy Version for a request
// where appropriate. Valid values are 0, 1, and 3.
//
// Requests specifying an invalid value will be rejected.
// Requests for conditional access policy binding in datasets must specify version 3.
//
// Dataset with no conditional role bindings in access policy may specify any valid value
// or leave the field unset.
//
// This field will be mapped to [IAM Policy version] (https://cloud.google.com/iam/docs/policies#versions)
// and will be used to fetch policy from IAM. If unset or if 0 or 1 value is used for
// dataset with conditional bindings, access entry with condition will have role string
// appended by 'withcond' string followed by a hash value.
//
// Please refer https://cloud.google.com/iam/docs/troubleshooting-withcond for more details.
func WithAccessPolicyVersion(apv int) DatasetOption {
return func(o *dsCallOption) {
o.accessPolicyVersion = apv
Expand Down Expand Up @@ -872,7 +887,7 @@ type Expr struct {
Location string
}

func (ex *Expr) ToBQ() *bq.Expr {
func (ex *Expr) toBQ() *bq.Expr {
if ex == nil {
return nil
}
Expand Down Expand Up @@ -942,7 +957,7 @@ const (
func (e *AccessEntry) toBQ() (*bq.DatasetAccess, error) {
q := &bq.DatasetAccess{
Role: string(e.Role),
Condition: e.Condition.ToBQ(),
Condition: e.Condition.toBQ(),
}
switch e.EntityType {
case DomainEntity:
Expand Down
Loading