...

Package datapolicies

import "cloud.google.com/go/bigquery/datapolicies/apiv1"
Overview
Index
Examples
Subdirectories

Overview ▾

Package datapolicies is an auto-generated package for the BigQuery Data Policy API.

Allows users to manage BigQuery data policies.

General documentation

For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:

Example usage

To get started with this package, create a client.

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyClient(ctx)
if err != nil {
	// TODO: Handle error.
}
defer c.Close()

The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.

Using the Client

The following is an example of making an API call with the newly created client.

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyClient(ctx)
if err != nil {
	// TODO: Handle error.
}
defer c.Close()

req := &datapoliciespb.CreateDataPolicyRequest{
	// TODO: Fill request struct fields.
	// See https://pkg.go.dev/cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb#CreateDataPolicyRequest.
}
resp, err := c.CreateDataPolicy(ctx, req)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewDataPolicyClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

Index ▾

func DefaultAuthScopes() []string
type DataPolicyCallOptions
type DataPolicyClient
    func NewDataPolicyClient(ctx context.Context, opts ...option.ClientOption) (*DataPolicyClient, error)
    func NewDataPolicyRESTClient(ctx context.Context, opts ...option.ClientOption) (*DataPolicyClient, error)
    func (c *DataPolicyClient) Close() error
    func (c *DataPolicyClient) Connection() *grpc.ClientConn
    func (c *DataPolicyClient) CreateDataPolicy(ctx context.Context, req *datapoliciespb.CreateDataPolicyRequest, opts ...gax.CallOption) (*datapoliciespb.DataPolicy, error)
    func (c *DataPolicyClient) DeleteDataPolicy(ctx context.Context, req *datapoliciespb.DeleteDataPolicyRequest, opts ...gax.CallOption) error
    func (c *DataPolicyClient) GetDataPolicy(ctx context.Context, req *datapoliciespb.GetDataPolicyRequest, opts ...gax.CallOption) (*datapoliciespb.DataPolicy, error)
    func (c *DataPolicyClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
    func (c *DataPolicyClient) ListDataPolicies(ctx context.Context, req *datapoliciespb.ListDataPoliciesRequest, opts ...gax.CallOption) *DataPolicyIterator
    func (c *DataPolicyClient) RenameDataPolicy(ctx context.Context, req *datapoliciespb.RenameDataPolicyRequest, opts ...gax.CallOption) (*datapoliciespb.DataPolicy, error)
    func (c *DataPolicyClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
    func (c *DataPolicyClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
    func (c *DataPolicyClient) UpdateDataPolicy(ctx context.Context, req *datapoliciespb.UpdateDataPolicyRequest, opts ...gax.CallOption) (*datapoliciespb.DataPolicy, error)
type DataPolicyIterator
    func (it *DataPolicyIterator) Next() (*datapoliciespb.DataPolicy, error)
    func (it *DataPolicyIterator) PageInfo() *iterator.PageInfo

Package files

auxiliary.go data_policy_client.go doc.go version.go

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

type DataPolicyCallOptions

DataPolicyCallOptions contains the retry settings for each method of DataPolicyClient.

type DataPolicyCallOptions struct {
    CreateDataPolicy   []gax.CallOption
    UpdateDataPolicy   []gax.CallOption
    RenameDataPolicy   []gax.CallOption
    DeleteDataPolicy   []gax.CallOption
    GetDataPolicy      []gax.CallOption
    ListDataPolicies   []gax.CallOption
    GetIamPolicy       []gax.CallOption
    SetIamPolicy       []gax.CallOption
    TestIamPermissions []gax.CallOption
}

type DataPolicyClient

DataPolicyClient is a client for interacting with BigQuery Data Policy API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Data Policy Service provides APIs for managing the label-policy bindings.

type DataPolicyClient struct {

    // The call options for this service.
    CallOptions *DataPolicyCallOptions
    // contains filtered or unexported fields
}

func NewDataPolicyClient

func NewDataPolicyClient(ctx context.Context, opts ...option.ClientOption) (*DataPolicyClient, error)

NewDataPolicyClient creates a new data policy service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Data Policy Service provides APIs for managing the label-policy bindings.

Example

Code:

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

// TODO: Use client.
_ = c

func NewDataPolicyRESTClient

func NewDataPolicyRESTClient(ctx context.Context, opts ...option.ClientOption) (*DataPolicyClient, error)

NewDataPolicyRESTClient creates a new data policy service rest client.

Data Policy Service provides APIs for managing the label-policy bindings.

Example

Code:

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyRESTClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

// TODO: Use client.
_ = c

func (*DataPolicyClient) Close

func (c *DataPolicyClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*DataPolicyClient) Connection

func (c *DataPolicyClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*DataPolicyClient) CreateDataPolicy

func (c *DataPolicyClient) CreateDataPolicy(ctx context.Context, req *datapoliciespb.CreateDataPolicyRequest, opts ...gax.CallOption) (*datapoliciespb.DataPolicy, error)

CreateDataPolicy creates a new data policy under a project with the given dataPolicyId (used as the display name), policy tag, and data policy type.

Example

Code:

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &datapoliciespb.CreateDataPolicyRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb#CreateDataPolicyRequest.
}
resp, err := c.CreateDataPolicy(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

func (*DataPolicyClient) DeleteDataPolicy

func (c *DataPolicyClient) DeleteDataPolicy(ctx context.Context, req *datapoliciespb.DeleteDataPolicyRequest, opts ...gax.CallOption) error

DeleteDataPolicy deletes the data policy specified by its resource name.

Example

Code:

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &datapoliciespb.DeleteDataPolicyRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb#DeleteDataPolicyRequest.
}
err = c.DeleteDataPolicy(ctx, req)
if err != nil {
    // TODO: Handle error.
}

func (*DataPolicyClient) GetDataPolicy

func (c *DataPolicyClient) GetDataPolicy(ctx context.Context, req *datapoliciespb.GetDataPolicyRequest, opts ...gax.CallOption) (*datapoliciespb.DataPolicy, error)

GetDataPolicy gets the data policy specified by its resource name.

Example

Code:

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &datapoliciespb.GetDataPolicyRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb#GetDataPolicyRequest.
}
resp, err := c.GetDataPolicy(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

func (*DataPolicyClient) GetIamPolicy

func (c *DataPolicyClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

GetIamPolicy gets the IAM policy for the specified data policy.

Example

Code:

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &iampb.GetIamPolicyRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
}
resp, err := c.GetIamPolicy(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

func (*DataPolicyClient) ListDataPolicies

func (c *DataPolicyClient) ListDataPolicies(ctx context.Context, req *datapoliciespb.ListDataPoliciesRequest, opts ...gax.CallOption) *DataPolicyIterator

ListDataPolicies list all of the data policies in the specified parent project.

Example

Code:

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &datapoliciespb.ListDataPoliciesRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb#ListDataPoliciesRequest.
}
it := c.ListDataPolicies(ctx, req)
for {
    resp, err := it.Next()
    if err == iterator.Done {
        break
    }
    if err != nil {
        // TODO: Handle error.
    }
    // TODO: Use resp.
    _ = resp

    // If you need to access the underlying RPC response,
    // you can do so by casting the `Response` as below.
    // Otherwise, remove this line. Only populated after
    // first call to Next(). Not safe for concurrent access.
    _ = it.Response.(*datapoliciespb.ListDataPoliciesResponse)
}

func (*DataPolicyClient) RenameDataPolicy

func (c *DataPolicyClient) RenameDataPolicy(ctx context.Context, req *datapoliciespb.RenameDataPolicyRequest, opts ...gax.CallOption) (*datapoliciespb.DataPolicy, error)

RenameDataPolicy renames the id (display name) of the specified data policy.

Example

Code:

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &datapoliciespb.RenameDataPolicyRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb#RenameDataPolicyRequest.
}
resp, err := c.RenameDataPolicy(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

func (*DataPolicyClient) SetIamPolicy

func (c *DataPolicyClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

SetIamPolicy sets the IAM policy for the specified data policy.

Example

Code:

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &iampb.SetIamPolicyRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
}
resp, err := c.SetIamPolicy(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

func (*DataPolicyClient) TestIamPermissions

func (c *DataPolicyClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)

TestIamPermissions returns the caller’s permission on the specified data policy resource.

Example

Code:

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &iampb.TestIamPermissionsRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
}
resp, err := c.TestIamPermissions(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

func (*DataPolicyClient) UpdateDataPolicy

func (c *DataPolicyClient) UpdateDataPolicy(ctx context.Context, req *datapoliciespb.UpdateDataPolicyRequest, opts ...gax.CallOption) (*datapoliciespb.DataPolicy, error)

UpdateDataPolicy updates the metadata for an existing data policy. The target data policy can be specified by the resource name.

Example

Code:

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := datapolicies.NewDataPolicyClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &datapoliciespb.UpdateDataPolicyRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb#UpdateDataPolicyRequest.
}
resp, err := c.UpdateDataPolicy(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

type DataPolicyIterator

DataPolicyIterator manages a stream of *datapoliciespb.DataPolicy.

type DataPolicyIterator struct {

    // Response is the raw response for the current page.
    // It must be cast to the RPC response type.
    // Calling Next() or InternalFetch() updates this value.
    Response interface{}

    // InternalFetch is for use by the Google Cloud Libraries only.
    // It is not part of the stable interface of this package.
    //
    // InternalFetch returns results from a single call to the underlying RPC.
    // The number of results is no greater than pageSize.
    // If there are no more results, nextPageToken is empty and err is nil.
    InternalFetch func(pageSize int, pageToken string) (results []*datapoliciespb.DataPolicy, nextPageToken string, err error)
    // contains filtered or unexported fields
}

func (*DataPolicyIterator) Next

func (it *DataPolicyIterator) Next() (*datapoliciespb.DataPolicy, error)

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*DataPolicyIterator) PageInfo

func (it *DataPolicyIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

Subdirectories

Name Synopsis
..
datapoliciespb