- 1.64.0 (latest)
- 1.63.1
- 1.62.0
- 1.61.0
- 1.60.0
- 1.59.1
- 1.58.0
- 1.57.1
- 1.54.0
- 1.53.0
- 1.52.0
- 1.51.2
- 1.50.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.36.0
- 1.35.0
- 1.34.1
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.2
- 1.29.0
- 1.28.0
- 1.27.0
- 1.26.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.1
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
Package datapolicies is an auto-generated package for the BigQuery Data Policy API.
Allows users to manage BigQuery data policies.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
General documentation
For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.
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.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
DataPolicyCallOptions
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
}
DataPolicyCallOptions contains the retry settings for each method of DataPolicyClient.
DataPolicyClient
type DataPolicyClient struct {
// The call options for this service.
CallOptions *DataPolicyCallOptions
// contains filtered or unexported fields
}
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.
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
package main
import (
"context"
datapolicies "cloud.google.com/go/bigquery/datapolicies/apiv1"
)
func main() {
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
package main
import (
"context"
datapolicies "cloud.google.com/go/bigquery/datapolicies/apiv1"
)
func main() {
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 (deprecated)
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
package main
import (
"context"
datapolicies "cloud.google.com/go/bigquery/datapolicies/apiv1"
datapoliciespb "cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb"
)
func main() {
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
package main
import (
"context"
datapolicies "cloud.google.com/go/bigquery/datapolicies/apiv1"
datapoliciespb "cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb"
)
func main() {
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
package main
import (
"context"
datapolicies "cloud.google.com/go/bigquery/datapolicies/apiv1"
datapoliciespb "cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb"
)
func main() {
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
package main
import (
"context"
datapolicies "cloud.google.com/go/bigquery/datapolicies/apiv1"
iampb "cloud.google.com/go/iam/apiv1/iampb"
)
func main() {
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
package main
import (
"context"
datapolicies "cloud.google.com/go/bigquery/datapolicies/apiv1"
datapoliciespb "cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb"
"google.golang.org/api/iterator"
)
func main() {
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
}
}
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
package main
import (
"context"
datapolicies "cloud.google.com/go/bigquery/datapolicies/apiv1"
datapoliciespb "cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb"
)
func main() {
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
package main
import (
"context"
datapolicies "cloud.google.com/go/bigquery/datapolicies/apiv1"
iampb "cloud.google.com/go/iam/apiv1/iampb"
)
func main() {
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
package main
import (
"context"
datapolicies "cloud.google.com/go/bigquery/datapolicies/apiv1"
iampb "cloud.google.com/go/iam/apiv1/iampb"
)
func main() {
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
package main
import (
"context"
datapolicies "cloud.google.com/go/bigquery/datapolicies/apiv1"
datapoliciespb "cloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb"
)
func main() {
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
}
DataPolicyIterator
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
}
DataPolicyIterator manages a stream of *datapoliciespb.DataPolicy.
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.