RowAccessPolicy class

Represents access on a subset of rows on the specified table, defined by its filter predicate. Access to the subset of rows is controlled by its IAM policy.

Example Usage

Bigquery Row Access Policy Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const example = new gcp.bigquery.Dataset("example", {
    datasetId: "dataset_id",
    location: "US",
});
const exampleTable = new gcp.bigquery.Table("example", {
    deletionProtection: false,
    schema: `[
  {
    \\"name\\": \\"nullable_field\\",
    \\"type\\": \\"STRING\\"
  }
]
`,
    datasetId: example.datasetId,
    tableId: "table_id",
});
const exampleRowAccessPolicy = new gcp.bigquery.RowAccessPolicy("example", {
    datasetId: example.datasetId,
    tableId: exampleTable.tableId,
    policyId: "policy_id",
    filterPredicate: "nullable_field is not NULL",
    grantees: ["domain:google.com"],
});
import pulumi
import pulumi_gcp as gcp

example = gcp.bigquery.Dataset("example",
    dataset_id="dataset_id",
    location="US")
example_table = gcp.bigquery.Table("example",
    deletion_protection=False,
    schema="""[
  {
    \"name\": \"nullable_field\",
    \"type\": \"STRING\"
  }
]
""",
    dataset_id=example.dataset_id,
    table_id="table_id")
example_row_access_policy = gcp.bigquery.RowAccessPolicy("example",
    dataset_id=example.dataset_id,
    table_id=example_table.table_id,
    policy_id="policy_id",
    filter_predicate="nullable_field is not NULL",
    grantees=["domain:google.com"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var example = new Gcp.BigQuery.Dataset("example", new()
    {
        DatasetId = "dataset_id",
        Location = "US",
    });

    var exampleTable = new Gcp.BigQuery.Table("example", new()
    {
        DeletionProtection = false,
        Schema = @"[
  {
    \""name\"": \""nullable_field\"",
    \""type\"": \""STRING\""
  }
]
",
        DatasetId = example.DatasetId,
        TableId = "table_id",
    });

    var exampleRowAccessPolicy = new Gcp.BigQuery.RowAccessPolicy("example", new()
    {
        DatasetId = example.DatasetId,
        TableId = exampleTable.TableId,
        PolicyId = "policy_id",
        FilterPredicate = "nullable_field is not NULL",
        Grantees = new[]
        {
            "domain:google.com",
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/bigquery"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := bigquery.NewDataset(ctx, "example", &bigquery.DatasetArgs{
			DatasetId: pulumi.String("dataset_id"),
			Location:  pulumi.String("US"),
		})
		if err != nil {
			return err
		}
		exampleTable, err := bigquery.NewTable(ctx, "example", &bigquery.TableArgs{
			DeletionProtection: pulumi.Bool(false),
			Schema: pulumi.String(`[
  {
    \"name\": \"nullable_field\",
    \"type\": \"STRING\"
  }
]
`),
			DatasetId: example.DatasetId,
			TableId:   pulumi.String("table_id"),
		})
		if err != nil {
			return err
		}
		_, err = bigquery.NewRowAccessPolicy(ctx, "example", &bigquery.RowAccessPolicyArgs{
			DatasetId:       example.DatasetId,
			TableId:         exampleTable.TableId,
			PolicyId:        pulumi.String("policy_id"),
			FilterPredicate: pulumi.String("nullable_field is not NULL"),
			Grantees: pulumi.StringArray{
				pulumi.String("domain:google.com"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_bigquery_dataset" "example" {
  dataset_id = "dataset_id"
  location   = "US"
}
resource "gcp_bigquery_table" "example" {
  deletion_protection = false
  schema              = "[\n  {\n    \\\"name\\\": \\\"nullable_field\\\",\n    \\\"type\\\": \\\"STRING\\\"\n  }\n]\n"
  dataset_id          = gcp_bigquery_dataset.example.dataset_id
  table_id            = "table_id"
}
resource "gcp_bigquery_rowaccesspolicy" "example" {
  dataset_id       = gcp_bigquery_dataset.example.dataset_id
  table_id         = gcp_bigquery_table.example.table_id
  policy_id        = "policy_id"
  filter_predicate = "nullable_field is not NULL"
  grantees         = ["domain:google.com"]
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.bigquery.Dataset;
import com.pulumi.gcp.bigquery.DatasetArgs;
import com.pulumi.gcp.bigquery.Table;
import com.pulumi.gcp.bigquery.TableArgs;
import com.pulumi.gcp.bigquery.RowAccessPolicy;
import com.pulumi.gcp.bigquery.RowAccessPolicyArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Dataset("example", DatasetArgs.builder()
            .datasetId("dataset_id")
            .location("US")
            .build());

        var exampleTable = new Table("exampleTable", TableArgs.builder()
            .deletionProtection(false)
            .schema("""
[
  {
    \"name\": \"nullable_field\",
    \"type\": \"STRING\"
  }
]
            """)
            .datasetId(example.datasetId())
            .tableId("table_id")
            .build());

        var exampleRowAccessPolicy = new RowAccessPolicy("exampleRowAccessPolicy", RowAccessPolicyArgs.builder()
            .datasetId(example.datasetId())
            .tableId(exampleTable.tableId())
            .policyId("policy_id")
            .filterPredicate("nullable_field is not NULL")
            .grantees("domain:google.com")
            .build());

    }
}
resources:
  example:
    type: gcp:bigquery:Dataset
    properties:
      datasetId: dataset_id
      location: US
  exampleTable:
    type: gcp:bigquery:Table
    name: example
    properties:
      deletionProtection: false
      schema: |
        [
          {
            \"name\": \"nullable_field\",
            \"type\": \"STRING\"
          }
        ]
      datasetId: ${example.datasetId}
      tableId: table_id
  exampleRowAccessPolicy:
    type: gcp:bigquery:RowAccessPolicy
    name: example
    properties:
      datasetId: ${example.datasetId}
      tableId: ${exampleTable.tableId}
      policyId: policy_id
      filterPredicate: nullable_field is not NULL
      grantees:
        - domain:google.com

Import

RowAccessPolicy can be imported using any of these accepted formats:

  • projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}/rowAccessPolicies/{{policy_id}}
  • {{project}}/{{dataset_id}}/{{table_id}}/{{policy_id}}
  • {{dataset_id}}/{{table_id}}/{{policy_id}}

When using the pulumi import command, RowAccessPolicy can be imported using one of the formats above. For example:

$ pulumi import gcp:bigquery/rowAccessPolicy:RowAccessPolicy default projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}/rowAccessPolicies/{{policy_id}}
$ pulumi import gcp:bigquery/rowAccessPolicy:RowAccessPolicy default {{project}}/{{dataset_id}}/{{table_id}}/{{policy_id}}
$ pulumi import gcp:bigquery/rowAccessPolicy:RowAccessPolicy default {{dataset_id}}/{{table_id}}/{{policy_id}}

Constructors

RowAccessPolicy(String name, {RowAccessPolicyArgs? args, CustomResourceOptions? options})
Creates a new RowAccessPolicy. name The Pulumi resource name. args Arguments used to configure this RowAccessPolicy. The set of arguments for RowAccessPolicy. options Resource options controlling this resource's behavior.
RowAccessPolicy.reference(String urn)
Creates a typed reference to an existing RowAccessPolicy resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
creationTime ↔ Output<String>
The time when this row access policy was created, in milliseconds since the epoch.
latefinal
datasetId ↔ Output<String>
The ID of the dataset containing this row access policy.
latefinal
deletionPolicy ↔ Output<String>
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
latefinal
filterPredicate ↔ Output<String>
A SQL boolean expression that represents the rows defined by this row access policy, similar to the boolean expression in a WHERE clause of a SELECT query on a table. References to other tables, routines, and temporary functions are not supported. Examples: region="EU" dateField = CAST('2019-9-27' as DATE) nullableField is not NULL numericField BETWEEN 1.0 AND 5.0
latefinal
grantees ↔ Output<List<String>?>
Input only. The optional list of iamMember users or groups that specifies the initial members that the row-level access policy should be created with. grantees types:
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
lastModifiedTime ↔ Output<String>
The time when this row access policy was last modified, in milliseconds since the epoch.
latefinal
policyId ↔ Output<String>
The ID of the row access policy. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
latefinal
project ↔ Output<String>
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tableId ↔ Output<String>
The ID of the table containing this row access policy.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {RowAccessPolicyState? state, CustomResourceOptions? options}) → RowAccessPolicy
Gets an existing RowAccessPolicy resource's state with the given name and id.