Class DataPolicyServiceClient (2.40.0-rc)

Data Policy Service provides APIs for managing the BigQuery Data Policy.

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

DataPolicyServiceClient(DataPolicyServiceClient const &)

Copy and move support

Parameter
Name Description
DataPolicyServiceClient const &

DataPolicyServiceClient(DataPolicyServiceClient &&)

Copy and move support

Parameter
Name Description
DataPolicyServiceClient &&

DataPolicyServiceClient(std::shared_ptr< DataPolicyServiceConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< DataPolicyServiceConnection >
opts Options

Operators

operator=(DataPolicyServiceClient const &)

Copy and move support

Parameter
Name Description
DataPolicyServiceClient const &
Returns
Type Description
DataPolicyServiceClient &

operator=(DataPolicyServiceClient &&)

Copy and move support

Parameter
Name Description
DataPolicyServiceClient &&
Returns
Type Description
DataPolicyServiceClient &

Functions

CreateDataPolicy(std::string const &, google::cloud::bigquery::datapolicies::v2::DataPolicy const &, std::string const &, Options)

Creates a new data policy under a project with the given data_policy_id (used as the display name), and data policy type.

Parameters
Name Description
parent std::string const &

Required. Resource name of the project that the data policy will belong to. The format is projects/{project_number}/locations/{location_id}.

data_policy google::cloud::bigquery::datapolicies::v2::DataPolicy const &

Required. The data policy to create. The name field does not need to be provided for the data policy creation.

data_policy_id std::string const &

Required. User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {data_policy_id} in part of the resource name.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::bigquery::datapolicies::v2::DataPolicy >

the result of the RPC. The response message type (google.cloud.bigquery.datapolicies.v2.DataPolicy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateDataPolicy(google::cloud::bigquery::datapolicies::v2::CreateDataPolicyRequest const &, Options)

Creates a new data policy under a project with the given data_policy_id (used as the display name), and data policy type.

Parameters
Name Description
request google::cloud::bigquery::datapolicies::v2::CreateDataPolicyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.bigquery.datapolicies.v2.CreateDataPolicyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::bigquery::datapolicies::v2::DataPolicy >

the result of the RPC. The response message type (google.cloud.bigquery.datapolicies.v2.DataPolicy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

AddGrantees(std::string const &, std::vector< std::string > const &, Options)

Adds new grantees to a data policy.

The new grantees will be added to the existing grantees. If the request contains a duplicate grantee, the grantee will be ignored. If the request contains a grantee that already exists, the grantee will be ignored.

Parameters
Name Description
data_policy std::string const &

Required. Resource name of this data policy, in the format of projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}.

grantees std::vector< std::string > const &

Required. IAM principal that should be granted Fine Grained Access to the underlying data goverened by the data policy. The target data policy is determined by the data_policy field.
Uses the IAM V2 principal syntax. Supported principal types:

  • User
  • Group
  • Service account
opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::bigquery::datapolicies::v2::DataPolicy >

the result of the RPC. The response message type (google.cloud.bigquery.datapolicies.v2.DataPolicy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

AddGrantees(google::cloud::bigquery::datapolicies::v2::AddGranteesRequest const &, Options)

Adds new grantees to a data policy.

The new grantees will be added to the existing grantees. If the request contains a duplicate grantee, the grantee will be ignored. If the request contains a grantee that already exists, the grantee will be ignored.

Parameters
Name Description
request google::cloud::bigquery::datapolicies::v2::AddGranteesRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.bigquery.datapolicies.v2.AddGranteesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::bigquery::datapolicies::v2::DataPolicy >

the result of the RPC. The response message type (google.cloud.bigquery.datapolicies.v2.DataPolicy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

RemoveGrantees(std::string const &, std::vector< std::string > const &, Options)

Removes grantees from a data policy.

The grantees will be removed from the existing grantees. If the request contains a grantee that does not exist, the grantee will be ignored.

Parameters
Name Description
data_policy std::string const &

Required. Resource name of this data policy, in the format of projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}.

grantees std::vector< std::string > const &

Required. IAM principal that should be revoked from Fine Grained Access to the underlying data goverened by the data policy. The target data policy is determined by the data_policy field.
Uses the IAM V2 principal syntax. Supported principal types:

  • User
  • Group
  • Service account
opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::bigquery::datapolicies::v2::DataPolicy >

the result of the RPC. The response message type (google.cloud.bigquery.datapolicies.v2.DataPolicy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

RemoveGrantees(google::cloud::bigquery::datapolicies::v2::RemoveGranteesRequest const &, Options)

Removes grantees from a data policy.

The grantees will be removed from the existing grantees. If the request contains a grantee that does not exist, the grantee will be ignored.

Parameters
Name Description
request google::cloud::bigquery::datapolicies::v2::RemoveGranteesRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.bigquery.datapolicies.v2.RemoveGranteesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::bigquery::datapolicies::v2::DataPolicy >

the result of the RPC. The response message type (google.cloud.bigquery.datapolicies.v2.DataPolicy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateDataPolicy(google::cloud::bigquery::datapolicies::v2::DataPolicy const &, google::protobuf::FieldMask const &, Options)

Updates the metadata for an existing data policy.

The target data policy can be specified by the resource name.

Parameters
Name Description
data_policy google::cloud::bigquery::datapolicies::v2::DataPolicy const &

Required. Update the data policy's metadata.
The target data policy is determined by the name field. Other fields are updated to the specified values based on the field masks.

update_mask google::protobuf::FieldMask const &

Optional. The update mask applies to the resource. For the FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask If not set, defaults to all of the fields that are allowed to update.
Updates to the name and dataPolicyId fields are not allowed.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::bigquery::datapolicies::v2::DataPolicy >

the result of the RPC. The response message type (google.cloud.bigquery.datapolicies.v2.DataPolicy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateDataPolicy(google::cloud::bigquery::datapolicies::v2::UpdateDataPolicyRequest const &, Options)

Updates the metadata for an existing data policy.

The target data policy can be specified by the resource name.

Parameters
Name Description
request google::cloud::bigquery::datapolicies::v2::UpdateDataPolicyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.bigquery.datapolicies.v2.UpdateDataPolicyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::bigquery::datapolicies::v2::DataPolicy >

the result of the RPC. The response message type (google.cloud.bigquery.datapolicies.v2.DataPolicy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DeleteDataPolicy(std::string const &, Options)

Deletes the data policy specified by its resource name.

Parameters
Name Description
name std::string const &

Required. Resource name of the data policy to delete. Format is projects/{project_number}/locations/{location_id}/dataPolicies/{id}.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteDataPolicy(google::cloud::bigquery::datapolicies::v2::DeleteDataPolicyRequest const &, Options)

Deletes the data policy specified by its resource name.

Parameters
Name Description
request google::cloud::bigquery::datapolicies::v2::DeleteDataPolicyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.bigquery.datapolicies.v2.DeleteDataPolicyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

GetDataPolicy(std::string const &, Options)

Gets the data policy specified by its resource name.

Parameters
Name Description
name std::string const &

Required. Resource name of the requested data policy. Format is projects/{project_number}/locations/{location_id}/dataPolicies/{id}.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::bigquery::datapolicies::v2::DataPolicy >

the result of the RPC. The response message type (google.cloud.bigquery.datapolicies.v2.DataPolicy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetDataPolicy(google::cloud::bigquery::datapolicies::v2::GetDataPolicyRequest const &, Options)

Gets the data policy specified by its resource name.

Parameters
Name Description
request google::cloud::bigquery::datapolicies::v2::GetDataPolicyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.bigquery.datapolicies.v2.GetDataPolicyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::bigquery::datapolicies::v2::DataPolicy >

the result of the RPC. The response message type (google.cloud.bigquery.datapolicies.v2.DataPolicy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListDataPolicies(std::string const &, Options)

List all of the data policies in the specified parent project.

Parameters
Name Description
parent std::string const &

Required. Resource name of the project for which to list data policies. Format is projects/{project_number}/locations/{location_id}.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::bigquery::datapolicies::v2::DataPolicy >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.bigquery.datapolicies.v2.DataPolicy, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListDataPolicies(google::cloud::bigquery::datapolicies::v2::ListDataPoliciesRequest, Options)

List all of the data policies in the specified parent project.

Parameters
Name Description
request google::cloud::bigquery::datapolicies::v2::ListDataPoliciesRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.bigquery.datapolicies.v2.ListDataPoliciesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::bigquery::datapolicies::v2::DataPolicy >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.bigquery.datapolicies.v2.DataPolicy, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetIamPolicy(google::iam::v1::GetIamPolicyRequest const &, Options)

Gets the IAM policy for the specified data policy.

Parameters
Name Description
request google::iam::v1::GetIamPolicyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.iam.v1.GetIamPolicyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::iam::v1::Policy >

the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

SetIamPolicy(google::iam::v1::SetIamPolicyRequest const &, Options)

Sets the IAM policy for the specified data policy.

Parameters
Name Description
request google::iam::v1::SetIamPolicyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.iam.v1.SetIamPolicyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::iam::v1::Policy >

the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const &, Options)

Returns the caller's permission on the specified data policy resource.

Parameters
Name Description
request google::iam::v1::TestIamPermissionsRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.iam.v1.TestIamPermissionsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::iam::v1::TestIamPermissionsResponse >

the result of the RPC. The response message type (google.iam.v1.TestIamPermissionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.