Class ReservationServiceClient (2.43.0)

This API allows users to manage their BigQuery reservations.

A reservation provides computational resource guarantees, in the form of slots, to users. A slot is a unit of computational power in BigQuery, and serves as the basic unit of parallelism. In a scan of a multi-partitioned table, a single slot operates on a single partition of the table. A reservation resource exists as a child resource of the admin project and location, e.g.: projects/myproject/locations/US/reservations/reservationName.

A capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some committed period of usage. A capacity commitment resource exists as a child resource of the admin project and location, e.g.: projects/myproject/locations/US/capacityCommitments/id.

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

ReservationServiceClient(ReservationServiceClient const &)

Copy and move support

Parameter
Name Description
ReservationServiceClient const &

ReservationServiceClient(ReservationServiceClient &&)

Copy and move support

Parameter
Name Description
ReservationServiceClient &&

ReservationServiceClient(std::shared_ptr< ReservationServiceConnection >, Options)

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

Operators

operator=(ReservationServiceClient const &)

Copy and move support

Parameter
Name Description
ReservationServiceClient const &
Returns
Type Description
ReservationServiceClient &

operator=(ReservationServiceClient &&)

Copy and move support

Parameter
Name Description
ReservationServiceClient &&
Returns
Type Description
ReservationServiceClient &

Functions

CreateReservation(std::string const &, google::cloud::bigquery::reservation::v1::Reservation const &, std::string const &, Options)

Creates a new reservation resource.

Parameters
Name Description
parent std::string const &

Required. Project, location. E.g., projects/myproject/locations/US

reservation google::cloud::bigquery::reservation::v1::Reservation const &

Definition of the new reservation to create.

reservation_id std::string const &

The reservation ID. It must only contain lower case alphanumeric characters or dashes. It must start with a letter and must not end with a dash. Its maximum length is 64 characters.

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::Reservation >

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

CreateReservation(google::cloud::bigquery::reservation::v1::CreateReservationRequest const &, Options)

Creates a new reservation resource.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::CreateReservationRequest 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.reservation.v1.CreateReservationRequest. 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::reservation::v1::Reservation >

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

ListReservations(std::string const &, Options)

Lists all the reservations for the project in the specified location.

Parameters
Name Description
parent std::string const &

Required. The parent resource name containing project and location, e.g.: projects/myproject/locations/US

opts Options

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

Returns
Type Description
StreamRange< google::cloud::bigquery::reservation::v1::Reservation >

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.reservation.v1.Reservation, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListReservations(google::cloud::bigquery::reservation::v1::ListReservationsRequest, Options)

Lists all the reservations for the project in the specified location.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::ListReservationsRequest

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.reservation.v1.ListReservationsRequest. 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::reservation::v1::Reservation >

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.reservation.v1.Reservation, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetReservation(std::string const &, Options)

Returns information about the reservation.

Parameters
Name Description
name std::string const &

Required. Resource name of the reservation to retrieve. E.g., projects/myproject/locations/US/reservations/team1-prod

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::Reservation >

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

GetReservation(google::cloud::bigquery::reservation::v1::GetReservationRequest const &, Options)

Returns information about the reservation.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::GetReservationRequest 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.reservation.v1.GetReservationRequest. 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::reservation::v1::Reservation >

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

DeleteReservation(std::string const &, Options)

Deletes a reservation.

Returns google.rpc.Code.FAILED_PRECONDITION when reservation has assignments.

Parameters
Name Description
name std::string const &

Required. Resource name of the reservation to retrieve. E.g., projects/myproject/locations/US/reservations/team1-prod

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.

DeleteReservation(google::cloud::bigquery::reservation::v1::DeleteReservationRequest const &, Options)

Deletes a reservation.

Returns google.rpc.Code.FAILED_PRECONDITION when reservation has assignments.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::DeleteReservationRequest 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.reservation.v1.DeleteReservationRequest. 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.

UpdateReservation(google::cloud::bigquery::reservation::v1::Reservation const &, google::protobuf::FieldMask const &, Options)

Updates an existing reservation resource.

Parameters
Name Description
reservation google::cloud::bigquery::reservation::v1::Reservation const &

Content of the reservation to update.

update_mask google::protobuf::FieldMask const &

Standard field mask for the set of fields to be updated.

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::Reservation >

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

UpdateReservation(google::cloud::bigquery::reservation::v1::UpdateReservationRequest const &, Options)

Updates an existing reservation resource.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::UpdateReservationRequest 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.reservation.v1.UpdateReservationRequest. 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::reservation::v1::Reservation >

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

FailoverReservation(google::cloud::bigquery::reservation::v1::FailoverReservationRequest const &, Options)

Fail over a reservation to the secondary location.

The operation should be done in the current secondary location, which will be promoted to the new primary location for the reservation. Attempting to failover a reservation in the current primary location will fail with the error code google.rpc.Code.FAILED_PRECONDITION.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::FailoverReservationRequest 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.reservation.v1.FailoverReservationRequest. 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::reservation::v1::Reservation >

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

CreateCapacityCommitment(std::string const &, google::cloud::bigquery::reservation::v1::CapacityCommitment const &, Options)

Creates a new capacity commitment resource.

Parameters
Name Description
parent std::string const &

Required. Resource name of the parent reservation. E.g., projects/myproject/locations/US

capacity_commitment google::cloud::bigquery::reservation::v1::CapacityCommitment const &

Content of the capacity commitment to create.

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::CapacityCommitment >

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

CreateCapacityCommitment(google::cloud::bigquery::reservation::v1::CreateCapacityCommitmentRequest const &, Options)

Creates a new capacity commitment resource.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::CreateCapacityCommitmentRequest 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.reservation.v1.CreateCapacityCommitmentRequest. 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::reservation::v1::CapacityCommitment >

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

ListCapacityCommitments(std::string const &, Options)

Lists all the capacity commitments for the admin project.

Parameters
Name Description
parent std::string const &

Required. Resource name of the parent reservation. E.g., projects/myproject/locations/US

opts Options

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

Returns
Type Description
StreamRange< google::cloud::bigquery::reservation::v1::CapacityCommitment >

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.reservation.v1.CapacityCommitment, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListCapacityCommitments(google::cloud::bigquery::reservation::v1::ListCapacityCommitmentsRequest, Options)

Lists all the capacity commitments for the admin project.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::ListCapacityCommitmentsRequest

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.reservation.v1.ListCapacityCommitmentsRequest. 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::reservation::v1::CapacityCommitment >

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.reservation.v1.CapacityCommitment, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetCapacityCommitment(std::string const &, Options)

Returns information about the capacity commitment.

Parameters
Name Description
name std::string const &

Required. Resource name of the capacity commitment to retrieve. E.g., projects/myproject/locations/US/capacityCommitments/123

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::CapacityCommitment >

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

GetCapacityCommitment(google::cloud::bigquery::reservation::v1::GetCapacityCommitmentRequest const &, Options)

Returns information about the capacity commitment.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::GetCapacityCommitmentRequest 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.reservation.v1.GetCapacityCommitmentRequest. 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::reservation::v1::CapacityCommitment >

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

DeleteCapacityCommitment(std::string const &, Options)

Deletes a capacity commitment.

Attempting to delete capacity commitment before its commitment_end_time will fail with the error code google.rpc.Code.FAILED_PRECONDITION.

Parameters
Name Description
name std::string const &

Required. Resource name of the capacity commitment to delete. E.g., projects/myproject/locations/US/capacityCommitments/123

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.

DeleteCapacityCommitment(google::cloud::bigquery::reservation::v1::DeleteCapacityCommitmentRequest const &, Options)

Deletes a capacity commitment.

Attempting to delete capacity commitment before its commitment_end_time will fail with the error code google.rpc.Code.FAILED_PRECONDITION.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::DeleteCapacityCommitmentRequest 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.reservation.v1.DeleteCapacityCommitmentRequest. 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.

UpdateCapacityCommitment(google::cloud::bigquery::reservation::v1::CapacityCommitment const &, google::protobuf::FieldMask const &, Options)

Updates an existing capacity commitment.

Only plan and renewal_plan fields can be updated.

Plan can only be changed to a plan of a longer commitment period. Attempting to change to a plan with shorter commitment period will fail with the error code google.rpc.Code.FAILED_PRECONDITION.

Parameters
Name Description
capacity_commitment google::cloud::bigquery::reservation::v1::CapacityCommitment const &

Content of the capacity commitment to update.

update_mask google::protobuf::FieldMask const &

Standard field mask for the set of fields to be updated.

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::CapacityCommitment >

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

UpdateCapacityCommitment(google::cloud::bigquery::reservation::v1::UpdateCapacityCommitmentRequest const &, Options)

Updates an existing capacity commitment.

Only plan and renewal_plan fields can be updated.

Plan can only be changed to a plan of a longer commitment period. Attempting to change to a plan with shorter commitment period will fail with the error code google.rpc.Code.FAILED_PRECONDITION.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::UpdateCapacityCommitmentRequest 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.reservation.v1.UpdateCapacityCommitmentRequest. 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::reservation::v1::CapacityCommitment >

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

SplitCapacityCommitment(std::string const &, std::int64_t, Options)

Splits capacity commitment to two commitments of the same plan and commitment_end_time.

A common use case is to enable downgrading commitments.

For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes.

Parameters
Name Description
name std::string const &

Required. The resource name e.g.,: projects/myproject/locations/US/capacityCommitments/123

slot_count std::int64_t

Number of slots in the capacity commitment after the split.

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::SplitCapacityCommitmentResponse >

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

SplitCapacityCommitment(google::cloud::bigquery::reservation::v1::SplitCapacityCommitmentRequest const &, Options)

Splits capacity commitment to two commitments of the same plan and commitment_end_time.

A common use case is to enable downgrading commitments.

For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::SplitCapacityCommitmentRequest 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.reservation.v1.SplitCapacityCommitmentRequest. 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::reservation::v1::SplitCapacityCommitmentResponse >

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

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

Merges capacity commitments of the same plan into a single commitment.

The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments.

Attempting to merge capacity commitments of different plan will fail with the error code google.rpc.Code.FAILED_PRECONDITION.

Parameters
Name Description
parent std::string const &

Parent resource that identifies admin project and location e.g., projects/myproject/locations/us

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

Ids of capacity commitments to merge. These capacity commitments must exist under admin project and location specified in the parent. ID is the last portion of capacity commitment name e.g., 'abc' for projects/myproject/locations/US/capacityCommitments/abc

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::CapacityCommitment >

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

MergeCapacityCommitments(google::cloud::bigquery::reservation::v1::MergeCapacityCommitmentsRequest const &, Options)

Merges capacity commitments of the same plan into a single commitment.

The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments.

Attempting to merge capacity commitments of different plan will fail with the error code google.rpc.Code.FAILED_PRECONDITION.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::MergeCapacityCommitmentsRequest 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.reservation.v1.MergeCapacityCommitmentsRequest. 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::reservation::v1::CapacityCommitment >

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

CreateAssignment(std::string const &, google::cloud::bigquery::reservation::v1::Assignment const &, Options)

Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation.

Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type.

Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query.

When creating assignments, it does not matter if other assignments exist at higher levels.

Example:

  • The organization organizationA contains two projects, project1 and project2.
  • Assignments for all three entities (organizationA, project1, and project2) could all be created and mapped to the same or different reservations.

"None" assignments represent an absence of the assignment. Projects assigned to None use on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. Example parent: projects/myproject/locations/US/reservations/none.

Returns google.rpc.Code.PERMISSION_DENIED if user does not have 'bigquery.admin' permissions on the project using the reservation and the project that owns this reservation.

Returns google.rpc.Code.INVALID_ARGUMENT when location of the assignment does not match location of the reservation.

Parameters
Name Description
parent std::string const &

Required. The parent resource name of the assignment E.g. projects/myproject/locations/US/reservations/team1-prod

assignment google::cloud::bigquery::reservation::v1::Assignment const &

Assignment resource to create.

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::Assignment >

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

CreateAssignment(google::cloud::bigquery::reservation::v1::CreateAssignmentRequest const &, Options)

Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation.

Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type.

Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query.

When creating assignments, it does not matter if other assignments exist at higher levels.

Example:

  • The organization organizationA contains two projects, project1 and project2.
  • Assignments for all three entities (organizationA, project1, and project2) could all be created and mapped to the same or different reservations.

"None" assignments represent an absence of the assignment. Projects assigned to None use on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. Example parent: projects/myproject/locations/US/reservations/none.

Returns google.rpc.Code.PERMISSION_DENIED if user does not have 'bigquery.admin' permissions on the project using the reservation and the project that owns this reservation.

Returns google.rpc.Code.INVALID_ARGUMENT when location of the assignment does not match location of the reservation.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::CreateAssignmentRequest 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.reservation.v1.CreateAssignmentRequest. 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::reservation::v1::Assignment >

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

ListAssignments(std::string const &, Options)

Lists assignments.

Only explicitly created assignments will be returned.

Example:

  • Organization organizationA contains two projects, project1 and project2.
  • Reservation res1 exists and was created previously.
  • CreateAssignment was used previously to define the following associations between entities and reservations: <organizationA, res1> and <project1, res1>

In this example, ListAssignments will just return the above two assignments for reservation res1, and no expansion/merge will happen.

The wildcard "-" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed.

Note "-" cannot be used for projects nor locations.

Parameters
Name Description
parent std::string const &

Required. The parent resource name e.g.:
projects/myproject/locations/US/reservations/team1-prod
Or:
projects/myproject/locations/US/reservations/-

opts Options

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

Returns
Type Description
StreamRange< google::cloud::bigquery::reservation::v1::Assignment >

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.reservation.v1.Assignment, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListAssignments(google::cloud::bigquery::reservation::v1::ListAssignmentsRequest, Options)

Lists assignments.

Only explicitly created assignments will be returned.

Example:

  • Organization organizationA contains two projects, project1 and project2.
  • Reservation res1 exists and was created previously.
  • CreateAssignment was used previously to define the following associations between entities and reservations: <organizationA, res1> and <project1, res1>

In this example, ListAssignments will just return the above two assignments for reservation res1, and no expansion/merge will happen.

The wildcard "-" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed.

Note "-" cannot be used for projects nor locations.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::ListAssignmentsRequest

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.reservation.v1.ListAssignmentsRequest. 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::reservation::v1::Assignment >

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.reservation.v1.Assignment, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

DeleteAssignment(std::string const &, Options)

Deletes a assignment.

No expansion will happen.

Example:

  • Organization organizationA contains two projects, project1 and project2.
  • Reservation res1 exists and was created previously.
  • CreateAssignment was used previously to define the following associations between entities and reservations: <organizationA, res1> and <project1, res1>

In this example, deletion of the <organizationA, res1> assignment won't affect the other assignment <project1, res1>. After said deletion, queries from project1 will still use res1 while queries from project2 will switch to use on-demand mode.

Parameters
Name Description
name std::string const &

Required. Name of the resource, e.g. projects/myproject/locations/US/reservations/team1-prod/assignments/123

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.

DeleteAssignment(google::cloud::bigquery::reservation::v1::DeleteAssignmentRequest const &, Options)

Deletes a assignment.

No expansion will happen.

Example:

  • Organization organizationA contains two projects, project1 and project2.
  • Reservation res1 exists and was created previously.
  • CreateAssignment was used previously to define the following associations between entities and reservations: <organizationA, res1> and <project1, res1>

In this example, deletion of the <organizationA, res1> assignment won't affect the other assignment <project1, res1>. After said deletion, queries from project1 will still use res1 while queries from project2 will switch to use on-demand mode.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::DeleteAssignmentRequest 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.reservation.v1.DeleteAssignmentRequest. 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.

SearchAssignments(std::string const &, std::string const &, Options)

Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project:

  1. Assignments created on the project will be returned if they exist.
  2. Otherwise assignments created on the closest ancestor will be returned.
  3. Assignments for different JobTypes will all be returned.

The same logic applies if the request is about a folder.

If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).

Comparing to ListAssignments, there are some behavior differences:

  1. permission on the assignee will be verified in this API.
  2. Hierarchy lookup (project->folder->organization) happens in this API.
  3. Parent here is projects/*/locations/*, instead of projects/*/locations/*reservations/*.

Note "-" cannot be used for projects nor locations.

Parameters
Name Description
parent std::string const &

Required. The resource name of the admin project(containing project and location), e.g.: projects/myproject/locations/US.

query std::string const &

Please specify resource name as assignee in the query.
Examples:

  • assignee=projects/myproject
  • assignee=folders/123
  • assignee=organizations/456
opts Options

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

Returns
Type Description
StreamRange< google::cloud::bigquery::reservation::v1::Assignment >

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.reservation.v1.Assignment, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

SearchAssignments(google::cloud::bigquery::reservation::v1::SearchAssignmentsRequest, Options)

Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project:

  1. Assignments created on the project will be returned if they exist.
  2. Otherwise assignments created on the closest ancestor will be returned.
  3. Assignments for different JobTypes will all be returned.

The same logic applies if the request is about a folder.

If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).

Comparing to ListAssignments, there are some behavior differences:

  1. permission on the assignee will be verified in this API.
  2. Hierarchy lookup (project->folder->organization) happens in this API.
  3. Parent here is projects/*/locations/*, instead of projects/*/locations/*reservations/*.

Note "-" cannot be used for projects nor locations.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::SearchAssignmentsRequest

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.reservation.v1.SearchAssignmentsRequest. 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::reservation::v1::Assignment >

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.reservation.v1.Assignment, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

SearchAllAssignments(std::string const &, std::string const &, Options)

Looks up assignments for a specified resource for a particular region.

If the request is about a project:

  1. Assignments created on the project will be returned if they exist.
  2. Otherwise assignments created on the closest ancestor will be returned.
  3. Assignments for different JobTypes will all be returned.

The same logic applies if the request is about a folder.

If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).

Comparing to ListAssignments, there are some behavior differences:

  1. permission on the assignee will be verified in this API.
  2. Hierarchy lookup (project->folder->organization) happens in this API.
  3. Parent here is projects/*/locations/*, instead of projects/*/locations/*reservations/*.
Parameters
Name Description
parent std::string const &

Required. The resource name with location (project name could be the wildcard '-'), e.g.: projects/-/locations/US.

query std::string const &

Please specify resource name as assignee in the query.
Examples:

  • assignee=projects/myproject
  • assignee=folders/123
  • assignee=organizations/456
opts Options

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

Returns
Type Description
StreamRange< google::cloud::bigquery::reservation::v1::Assignment >

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.reservation.v1.Assignment, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

SearchAllAssignments(google::cloud::bigquery::reservation::v1::SearchAllAssignmentsRequest, Options)

Looks up assignments for a specified resource for a particular region.

If the request is about a project:

  1. Assignments created on the project will be returned if they exist.
  2. Otherwise assignments created on the closest ancestor will be returned.
  3. Assignments for different JobTypes will all be returned.

The same logic applies if the request is about a folder.

If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).

Comparing to ListAssignments, there are some behavior differences:

  1. permission on the assignee will be verified in this API.
  2. Hierarchy lookup (project->folder->organization) happens in this API.
  3. Parent here is projects/*/locations/*, instead of projects/*/locations/*reservations/*.
Parameters
Name Description
request google::cloud::bigquery::reservation::v1::SearchAllAssignmentsRequest

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.reservation.v1.SearchAllAssignmentsRequest. 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::reservation::v1::Assignment >

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.reservation.v1.Assignment, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

MoveAssignment(std::string const &, std::string const &, Options)

Moves an assignment under a new reservation.

This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.

Parameters
Name Description
name std::string const &

Required. The resource name of the assignment, e.g. projects/myproject/locations/US/reservations/team1-prod/assignments/123

destination_id std::string const &

The new reservation ID, e.g.: projects/myotherproject/locations/US/reservations/team2-prod

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::Assignment >

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

MoveAssignment(google::cloud::bigquery::reservation::v1::MoveAssignmentRequest const &, Options)

Moves an assignment under a new reservation.

This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::MoveAssignmentRequest 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.reservation.v1.MoveAssignmentRequest. 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::reservation::v1::Assignment >

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

UpdateAssignment(google::cloud::bigquery::reservation::v1::Assignment const &, google::protobuf::FieldMask const &, Options)

Updates an existing assignment.

Only the priority field can be updated.

Parameters
Name Description
assignment google::cloud::bigquery::reservation::v1::Assignment const &

Content of the assignment to update.

update_mask google::protobuf::FieldMask const &

Standard field mask for the set of fields to be updated.

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::Assignment >

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

UpdateAssignment(google::cloud::bigquery::reservation::v1::UpdateAssignmentRequest const &, Options)

Updates an existing assignment.

Only the priority field can be updated.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::UpdateAssignmentRequest 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.reservation.v1.UpdateAssignmentRequest. 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::reservation::v1::Assignment >

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

GetBiReservation(std::string const &, Options)

Retrieves a BI reservation.

Parameters
Name Description
name std::string const &

Required. Name of the requested reservation, for example: projects/{project_id}/locations/{location_id}/biReservation

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::BiReservation >

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

GetBiReservation(google::cloud::bigquery::reservation::v1::GetBiReservationRequest const &, Options)

Retrieves a BI reservation.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::GetBiReservationRequest 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.reservation.v1.GetBiReservationRequest. 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::reservation::v1::BiReservation >

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

UpdateBiReservation(google::cloud::bigquery::reservation::v1::BiReservation const &, google::protobuf::FieldMask const &, Options)

Updates a BI reservation.

Only fields specified in the field_mask are updated.

A singleton BI reservation always exists with default size 0. In order to reserve BI capacity it needs to be updated to an amount greater than 0. In order to release BI capacity reservation size must be set to 0.

Parameters
Name Description
bi_reservation google::cloud::bigquery::reservation::v1::BiReservation const &

A reservation to update.

update_mask google::protobuf::FieldMask const &

A list of fields to be updated in this request.

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::BiReservation >

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

UpdateBiReservation(google::cloud::bigquery::reservation::v1::UpdateBiReservationRequest const &, Options)

Updates a BI reservation.

Only fields specified in the field_mask are updated.

A singleton BI reservation always exists with default size 0. In order to reserve BI capacity it needs to be updated to an amount greater than 0. In order to release BI capacity reservation size must be set to 0.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::UpdateBiReservationRequest 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.reservation.v1.UpdateBiReservationRequest. 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::reservation::v1::BiReservation >

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

GetIamPolicy(std::string const &, Options)

Gets the access control policy for a resource.

May return:

  • ANOT_FOUND error if the resource doesn't exist or you don't have the permission to view it.
  • An empty policy if the resource exists but doesn't have a set policy.

Supported resources are:

  • Reservations
  • ReservationAssignments

To call this method, you must have the following Google IAM permissions:

  • bigqueryreservation.reservations.getIamPolicy to get policies on reservations.
Parameters
Name Description
resource std::string const &

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

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.

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

Gets the access control policy for a resource.

May return:

  • ANOT_FOUND error if the resource doesn't exist or you don't have the permission to view it.
  • An empty policy if the resource exists but doesn't have a set policy.

Supported resources are:

  • Reservations
  • ReservationAssignments

To call this method, you must have the following Google IAM permissions:

  • bigqueryreservation.reservations.getIamPolicy to get policies on reservations.
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(std::string const &, google::iam::v1::Policy const &, Options)

Sets an access control policy for a resource.

Replaces any existing policy.

Supported resources are:

  • Reservations

To call this method, you must have the following Google IAM permissions:

  • bigqueryreservation.reservations.setIamPolicy to set policies on reservations.
Parameters
Name Description
resource std::string const &

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policy google::iam::v1::Policy const &

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

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(std::string const &, IamUpdater const &, Options)

Updates the IAM policy for resource using an optimistic concurrency control loop.

The loop fetches the current policy for resource, and passes it to updater, which should return the new policy. This new policy should use the current etag so that the read-modify-write cycle can detect races and rerun the update when there is a mismatch. If the new policy does not have an etag, the existing policy will be blindly overwritten. If updater does not yield a policy, the control loop is terminated and kCancelled is returned.

Parameters
Name Description
resource std::string const &

Required. The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

updater IamUpdater const &

Required. Functor to map the current policy to a new one.

opts Options

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

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

google::iam::v1::Policy

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

Sets an access control policy for a resource.

Replaces any existing policy.

Supported resources are:

  • Reservations

To call this method, you must have the following Google IAM permissions:

  • bigqueryreservation.reservations.setIamPolicy to set policies on reservations.
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)

Gets your permissions on a resource.

Returns an empty set of permissions if the resource doesn't exist.

Supported resources are:

  • Reservations

No Google IAM permissions are required to call this method.

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.

CreateReservationGroup(google::cloud::bigquery::reservation::v1::CreateReservationGroupRequest const &, Options)

Creates a new reservation group.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::CreateReservationGroupRequest 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.reservation.v1.CreateReservationGroupRequest. 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::reservation::v1::ReservationGroup >

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

GetReservationGroup(std::string const &, Options)

Returns information about the reservation group.

Parameters
Name Description
name std::string const &

Required. Resource name of the reservation group to retrieve. E.g., projects/myproject/locations/US/reservationGroups/team1-prod

opts Options

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

Returns
Type Description
StatusOr< google::cloud::bigquery::reservation::v1::ReservationGroup >

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

GetReservationGroup(google::cloud::bigquery::reservation::v1::GetReservationGroupRequest const &, Options)

Returns information about the reservation group.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::GetReservationGroupRequest 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.reservation.v1.GetReservationGroupRequest. 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::reservation::v1::ReservationGroup >

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

DeleteReservationGroup(std::string const &, Options)

Deletes a reservation.

Returns google.rpc.Code.FAILED_PRECONDITION when reservation has assignments.

Parameters
Name Description
name std::string const &

Required. Resource name of the reservation group to retrieve. E.g., projects/myproject/locations/US/reservationGroups/team1-prod

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.

DeleteReservationGroup(google::cloud::bigquery::reservation::v1::DeleteReservationGroupRequest const &, Options)

Deletes a reservation.

Returns google.rpc.Code.FAILED_PRECONDITION when reservation has assignments.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::DeleteReservationGroupRequest 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.reservation.v1.DeleteReservationGroupRequest. 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.

ListReservationGroups(std::string const &, Options)

Lists all the reservation groups for the project in the specified location.

Parameters
Name Description
parent std::string const &

Required. The parent resource name containing project and location, e.g.: projects/myproject/locations/US

opts Options

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

Returns
Type Description
StreamRange< google::cloud::bigquery::reservation::v1::ReservationGroup >

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.reservation.v1.ReservationGroup, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListReservationGroups(google::cloud::bigquery::reservation::v1::ListReservationGroupsRequest, Options)

Lists all the reservation groups for the project in the specified location.

Parameters
Name Description
request google::cloud::bigquery::reservation::v1::ListReservationGroupsRequest

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.reservation.v1.ListReservationGroupsRequest. 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::reservation::v1::ReservationGroup >

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.reservation.v1.ReservationGroup, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.