Class v1.ReservationServiceClient (3.5.0)

This API allows users to manage their BigQuery reservations.

A reservation provides computational resource guarantees, in the form of [slots](https://cloud.google.com/bigquery/docs/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. v1

Package

@google-cloud/bigquery-reservation

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of ReservationServiceClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new ReservationServiceClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

reservationServiceStub

reservationServiceStub?: Promise<{
        [name: string]: Function;
    }>;

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

universeDomain

get universeDomain(): string;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

assignmentPath(project, location, reservation, assignment)

assignmentPath(project: string, location: string, reservation: string, assignment: string): string;

Return a fully-qualified assignment resource name string.

Parameters
Name Description
project string
location string
reservation string
assignment string
Returns
Type Description
string

{string} Resource name string.

biReservationPath(project, location)

biReservationPath(project: string, location: string): string;

Return a fully-qualified biReservation resource name string.

Parameters
Name Description
project string
location string
Returns
Type Description
string

{string} Resource name string.

capacityCommitmentPath(project, location, capacityCommitment)

capacityCommitmentPath(project: string, location: string, capacityCommitment: string): string;

Return a fully-qualified capacityCommitment resource name string.

Parameters
Name Description
project string
location string
capacityCommitment string
Returns
Type Description
string

{string} Resource name string.

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
Type Description
Promise<void>

{Promise} A promise that resolves when the client is closed.

createAssignment(request, options)

createAssignment(request?: protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IAssignment,
        (protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest | undefined),
        {} | undefined
    ]>;

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 ICreateAssignmentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IAssignment, (protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent resource name of the assignment
   *  E.g. `projects/myproject/locations/US/reservations/team1-prod`
   */
  // const parent = 'abc123'
  /**
   *  Assignment resource to create.
   */
  // const assignment = {}
  /**
   *  The optional assignment ID. Assignment name will be generated automatically
   *  if this field is empty.
   *  This field must only contain lower case alphanumeric characters or dashes.
   *  Max length is 64 characters.
   */
  // const assignmentId = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callCreateAssignment() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const response = await reservationClient.createAssignment(request);
    console.log(response);
  }

  callCreateAssignment();

createAssignment(request, options, callback)

createAssignment(request: protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IAssignment, protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateAssignmentRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.IAssignment, protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createAssignment(request, callback)

createAssignment(request: protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IAssignment, protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateAssignmentRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.IAssignment, protos.google.cloud.bigquery.reservation.v1.ICreateAssignmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createCapacityCommitment(request, options)

createCapacityCommitment(request?: protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment,
        (protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest | undefined),
        {} | undefined
    ]>;

Creates a new capacity commitment resource.

Parameters
Name Description
request ICreateCapacityCommitmentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, (protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Resource name of the parent reservation. E.g.,
   *     `projects/myproject/locations/US`
   */
  // const parent = 'abc123'
  /**
   *  Content of the capacity commitment to create.
   */
  // const capacityCommitment = {}
  /**
   *  If true, fail the request if another project in the organization has a
   *  capacity commitment.
   */
  // const enforceSingleAdminProjectPerOrg = true
  /**
   *  The optional capacity commitment ID. Capacity commitment name will be
   *  generated automatically if this field is empty.
   *  This field must only contain lower case alphanumeric characters or dashes.
   *  The first and last character cannot be a dash. Max length is 64 characters.
   *  NOTE: this ID won't be kept if the capacity commitment is split or merged.
   */
  // const capacityCommitmentId = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callCreateCapacityCommitment() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const response = await reservationClient.createCapacityCommitment(request);
    console.log(response);
  }

  callCreateCapacityCommitment();

createCapacityCommitment(request, options, callback)

createCapacityCommitment(request: protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateCapacityCommitmentRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createCapacityCommitment(request, callback)

createCapacityCommitment(request: protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateCapacityCommitmentRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.ICreateCapacityCommitmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createReservation(request, options)

createReservation(request?: protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IReservation,
        (protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest | undefined),
        {} | undefined
    ]>;

Creates a new reservation resource.

Parameters
Name Description
request ICreateReservationRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IReservation, (protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Project, location. E.g.,
   *  `projects/myproject/locations/US`
   */
  // const parent = 'abc123'
  /**
   *  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.
   */
  // const reservationId = 'abc123'
  /**
   *  Definition of the new reservation to create.
   */
  // const reservation = {}

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callCreateReservation() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const response = await reservationClient.createReservation(request);
    console.log(response);
  }

  callCreateReservation();

createReservation(request, options, callback)

createReservation(request: protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateReservationRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createReservation(request, callback)

createReservation(request: protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateReservationRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.ICreateReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteAssignment(request, options)

deleteAssignment(request?: protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest | undefined),
        {} | undefined
    ]>;

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 IDeleteAssignmentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, (protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the resource, e.g.
   *    `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
   */
  // const name = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callDeleteAssignment() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await reservationClient.deleteAssignment(request);
    console.log(response);
  }

  callDeleteAssignment();

deleteAssignment(request, options, callback)

deleteAssignment(request: protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteAssignmentRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteAssignment(request, callback)

deleteAssignment(request: protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteAssignmentRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.reservation.v1.IDeleteAssignmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteCapacityCommitment(request, options)

deleteCapacityCommitment(request?: protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest | undefined),
        {} | undefined
    ]>;

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 IDeleteCapacityCommitmentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, (protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Resource name of the capacity commitment to delete. E.g.,
   *     `projects/myproject/locations/US/capacityCommitments/123`
   */
  // const name = 'abc123'
  /**
   *  Can be used to force delete commitments even if assignments exist. Deleting
   *  commitments with assignments may cause queries to fail if they no longer
   *  have access to slots.
   */
  // const force = true

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callDeleteCapacityCommitment() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await reservationClient.deleteCapacityCommitment(request);
    console.log(response);
  }

  callDeleteCapacityCommitment();

deleteCapacityCommitment(request, options, callback)

deleteCapacityCommitment(request: protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteCapacityCommitmentRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteCapacityCommitment(request, callback)

deleteCapacityCommitment(request: protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteCapacityCommitmentRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.reservation.v1.IDeleteCapacityCommitmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteReservation(request, options)

deleteReservation(request?: protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest | undefined),
        {} | undefined
    ]>;

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

Parameters
Name Description
request IDeleteReservationRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, (protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Resource name of the reservation to retrieve. E.g.,
   *     `projects/myproject/locations/US/reservations/team1-prod`
   */
  // const name = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callDeleteReservation() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await reservationClient.deleteReservation(request);
    console.log(response);
  }

  callDeleteReservation();

deleteReservation(request, options, callback)

deleteReservation(request: protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteReservationRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteReservation(request, callback)

deleteReservation(request: protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteReservationRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.reservation.v1.IDeleteReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

failoverReservation(request, options)

failoverReservation(request?: protos.google.cloud.bigquery.reservation.v1.IFailoverReservationRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IReservation,
        (protos.google.cloud.bigquery.reservation.v1.IFailoverReservationRequest | undefined),
        {} | undefined
    ]>;

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 IFailoverReservationRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IReservation, (protos.google.cloud.bigquery.reservation.v1.IFailoverReservationRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Resource name of the reservation to failover. E.g.,
   *     `projects/myproject/locations/US/reservations/team1-prod`
   */
  // const name = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callFailoverReservation() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await reservationClient.failoverReservation(request);
    console.log(response);
  }

  callFailoverReservation();

failoverReservation(request, options, callback)

failoverReservation(request: protos.google.cloud.bigquery.reservation.v1.IFailoverReservationRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.IFailoverReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IFailoverReservationRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.IFailoverReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

failoverReservation(request, callback)

failoverReservation(request: protos.google.cloud.bigquery.reservation.v1.IFailoverReservationRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.IFailoverReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IFailoverReservationRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.IFailoverReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getBiReservation(request, options)

getBiReservation(request?: protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IBiReservation,
        (protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest | undefined),
        {} | undefined
    ]>;

Retrieves a BI reservation.

Parameters
Name Description
request IGetBiReservationRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IBiReservation, (protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing BiReservation. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the requested reservation, for example:
   *  `projects/{project_id}/locations/{location_id}/biReservation`
   */
  // const name = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callGetBiReservation() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await reservationClient.getBiReservation(request);
    console.log(response);
  }

  callGetBiReservation();

getBiReservation(request, options, callback)

getBiReservation(request: protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IBiReservation, protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetBiReservationRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.IBiReservation, protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getBiReservation(request, callback)

getBiReservation(request: protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IBiReservation, protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetBiReservationRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.IBiReservation, protos.google.cloud.bigquery.reservation.v1.IGetBiReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getCapacityCommitment(request, options)

getCapacityCommitment(request?: protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment,
        (protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest | undefined),
        {} | undefined
    ]>;

Returns information about the capacity commitment.

Parameters
Name Description
request IGetCapacityCommitmentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, (protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Resource name of the capacity commitment to retrieve. E.g.,
   *     `projects/myproject/locations/US/capacityCommitments/123`
   */
  // const name = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callGetCapacityCommitment() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await reservationClient.getCapacityCommitment(request);
    console.log(response);
  }

  callGetCapacityCommitment();

getCapacityCommitment(request, options, callback)

getCapacityCommitment(request: protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetCapacityCommitmentRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getCapacityCommitment(request, callback)

getCapacityCommitment(request: protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetCapacityCommitmentRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.IGetCapacityCommitmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
void

getReservation(request, options)

getReservation(request?: protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IReservation,
        (protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest | undefined),
        {} | undefined
    ]>;

Returns information about the reservation.

Parameters
Name Description
request IGetReservationRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IReservation, (protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Resource name of the reservation to retrieve. E.g.,
   *     `projects/myproject/locations/US/reservations/team1-prod`
   */
  // const name = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callGetReservation() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await reservationClient.getReservation(request);
    console.log(response);
  }

  callGetReservation();

getReservation(request, options, callback)

getReservation(request: protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetReservationRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getReservation(request, callback)

getReservation(request: protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetReservationRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.IGetReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
Type Description
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

listAssignments(request, options)

listAssignments(request?: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IAssignment[],
        protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest | null,
        protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse
    ]>;

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 IListAssignmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IAssignment[], protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest | null, protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listAssignmentsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listAssignments(request, options, callback)

listAssignments(request: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IAssignment>): void;
Parameters
Name Description
request IListAssignmentsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IAssignment>
Returns
Type Description
void

listAssignments(request, callback)

listAssignments(request: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, callback: PaginationCallback<protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IAssignment>): void;
Parameters
Name Description
request IListAssignmentsRequest
callback PaginationCallback<protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, protos.google.cloud.bigquery.reservation.v1.IListAssignmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IAssignment>
Returns
Type Description
void

listAssignmentsAsync(request, options)

listAssignmentsAsync(request?: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.bigquery.reservation.v1.IAssignment>;

Equivalent to listAssignments, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListAssignmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.bigquery.reservation.v1.IAssignment>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent resource name e.g.:
   *  `projects/myproject/locations/US/reservations/team1-prod`
   *  Or:
   *  `projects/myproject/locations/US/reservations/-`
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of items to return per page.
   */
  // const pageSize = 1234
  /**
   *  The next_page_token value returned from a previous List request, if any.
   */
  // const pageToken = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callListAssignments() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = reservationClient.listAssignmentsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListAssignments();

listAssignmentsStream(request, options)

listAssignmentsStream(request?: protos.google.cloud.bigquery.reservation.v1.IListAssignmentsRequest, options?: CallOptions): Transform;

Equivalent to listAssignments, but returns a NodeJS Stream object.

Parameters
Name Description
request IListAssignmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listAssignmentsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listCapacityCommitments(request, options)

listCapacityCommitments(request?: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment[],
        protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest | null,
        protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse
    ]>;

Lists all the capacity commitments for the admin project.

Parameters
Name Description
request IListCapacityCommitmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment[], protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest | null, protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listCapacityCommitmentsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listCapacityCommitments(request, options, callback)

listCapacityCommitments(request: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>): void;
Parameters
Name Description
request IListCapacityCommitmentsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>
Returns
Type Description
void

listCapacityCommitments(request, callback)

listCapacityCommitments(request: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, callback: PaginationCallback<protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>): void;
Parameters
Name Description
request IListCapacityCommitmentsRequest
callback PaginationCallback<protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>
Returns
Type Description
void

listCapacityCommitmentsAsync(request, options)

listCapacityCommitmentsAsync(request?: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>;

Equivalent to listCapacityCommitments, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListCapacityCommitmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Resource name of the parent reservation. E.g.,
   *     `projects/myproject/locations/US`
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of items to return.
   */
  // const pageSize = 1234
  /**
   *  The next_page_token value returned from a previous List request, if any.
   */
  // const pageToken = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callListCapacityCommitments() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = reservationClient.listCapacityCommitmentsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListCapacityCommitments();

listCapacityCommitmentsStream(request, options)

listCapacityCommitmentsStream(request?: protos.google.cloud.bigquery.reservation.v1.IListCapacityCommitmentsRequest, options?: CallOptions): Transform;

Equivalent to listCapacityCommitments, but returns a NodeJS Stream object.

Parameters
Name Description
request IListCapacityCommitmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listCapacityCommitmentsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listReservations(request, options)

listReservations(request?: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IReservation[],
        protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest | null,
        protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse
    ]>;

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

Parameters
Name Description
request IListReservationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IReservation[], protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest | null, protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listReservationsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listReservations(request, options, callback)

listReservations(request: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IReservation>): void;
Parameters
Name Description
request IListReservationsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IReservation>
Returns
Type Description
void

listReservations(request, callback)

listReservations(request: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, callback: PaginationCallback<protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IReservation>): void;
Parameters
Name Description
request IListReservationsRequest
callback PaginationCallback<protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, protos.google.cloud.bigquery.reservation.v1.IListReservationsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IReservation>
Returns
Type Description
void

listReservationsAsync(request, options)

listReservationsAsync(request?: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.bigquery.reservation.v1.IReservation>;

Equivalent to listReservations, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListReservationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.bigquery.reservation.v1.IReservation>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent resource name containing project and location, e.g.:
   *    `projects/myproject/locations/US`
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of items to return per page.
   */
  // const pageSize = 1234
  /**
   *  The next_page_token value returned from a previous List request, if any.
   */
  // const pageToken = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callListReservations() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = reservationClient.listReservationsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListReservations();

listReservationsStream(request, options)

listReservationsStream(request?: protos.google.cloud.bigquery.reservation.v1.IListReservationsRequest, options?: CallOptions): Transform;

Equivalent to listReservations, but returns a NodeJS Stream object.

Parameters
Name Description
request IListReservationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listReservationsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
Name Description
project string
location string
Returns
Type Description
string

{string} Resource name string.

matchAssignmentFromAssignmentName(assignmentName)

matchAssignmentFromAssignmentName(assignmentName: string): string | number;

Parse the assignment from Assignment resource.

Parameter
Name Description
assignmentName string

A fully-qualified path representing Assignment resource.

Returns
Type Description
string | number

{string} A string representing the assignment.

matchCapacityCommitmentFromCapacityCommitmentName(capacityCommitmentName)

matchCapacityCommitmentFromCapacityCommitmentName(capacityCommitmentName: string): string | number;

Parse the capacity_commitment from CapacityCommitment resource.

Parameter
Name Description
capacityCommitmentName string

A fully-qualified path representing CapacityCommitment resource.

Returns
Type Description
string | number

{string} A string representing the capacity_commitment.

matchLocationFromAssignmentName(assignmentName)

matchLocationFromAssignmentName(assignmentName: string): string | number;

Parse the location from Assignment resource.

Parameter
Name Description
assignmentName string

A fully-qualified path representing Assignment resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromBiReservationName(biReservationName)

matchLocationFromBiReservationName(biReservationName: string): string | number;

Parse the location from BiReservation resource.

Parameter
Name Description
biReservationName string

A fully-qualified path representing BiReservation resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromCapacityCommitmentName(capacityCommitmentName)

matchLocationFromCapacityCommitmentName(capacityCommitmentName: string): string | number;

Parse the location from CapacityCommitment resource.

Parameter
Name Description
capacityCommitmentName string

A fully-qualified path representing CapacityCommitment resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromReservationName(reservationName)

matchLocationFromReservationName(reservationName: string): string | number;

Parse the location from Reservation resource.

Parameter
Name Description
reservationName string

A fully-qualified path representing Reservation resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchProjectFromAssignmentName(assignmentName)

matchProjectFromAssignmentName(assignmentName: string): string | number;

Parse the project from Assignment resource.

Parameter
Name Description
assignmentName string

A fully-qualified path representing Assignment resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromBiReservationName(biReservationName)

matchProjectFromBiReservationName(biReservationName: string): string | number;

Parse the project from BiReservation resource.

Parameter
Name Description
biReservationName string

A fully-qualified path representing BiReservation resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromCapacityCommitmentName(capacityCommitmentName)

matchProjectFromCapacityCommitmentName(capacityCommitmentName: string): string | number;

Parse the project from CapacityCommitment resource.

Parameter
Name Description
capacityCommitmentName string

A fully-qualified path representing CapacityCommitment resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromProjectName(projectName)

matchProjectFromProjectName(projectName: string): string | number;

Parse the project from Project resource.

Parameter
Name Description
projectName string

A fully-qualified path representing Project resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromReservationName(reservationName)

matchProjectFromReservationName(reservationName: string): string | number;

Parse the project from Reservation resource.

Parameter
Name Description
reservationName string

A fully-qualified path representing Reservation resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchReservationFromAssignmentName(assignmentName)

matchReservationFromAssignmentName(assignmentName: string): string | number;

Parse the reservation from Assignment resource.

Parameter
Name Description
assignmentName string

A fully-qualified path representing Assignment resource.

Returns
Type Description
string | number

{string} A string representing the reservation.

matchReservationFromReservationName(reservationName)

matchReservationFromReservationName(reservationName: string): string | number;

Parse the reservation from Reservation resource.

Parameter
Name Description
reservationName string

A fully-qualified path representing Reservation resource.

Returns
Type Description
string | number

{string} A string representing the reservation.

mergeCapacityCommitments(request, options)

mergeCapacityCommitments(request?: protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment,
        (protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest | undefined),
        {} | undefined
    ]>;

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 IMergeCapacityCommitmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, (protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Parent resource that identifies admin project and location e.g.,
   *   `projects/myproject/locations/us`
   */
  // const parent = 'abc123'
  /**
   *  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
   */
  // const capacityCommitmentIds = ['abc','def']

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callMergeCapacityCommitments() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await reservationClient.mergeCapacityCommitments(request);
    console.log(response);
  }

  callMergeCapacityCommitments();

mergeCapacityCommitments(request, options, callback)

mergeCapacityCommitments(request: protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IMergeCapacityCommitmentsRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

mergeCapacityCommitments(request, callback)

mergeCapacityCommitments(request: protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IMergeCapacityCommitmentsRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.IMergeCapacityCommitmentsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

moveAssignment(request, options)

moveAssignment(request?: protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IAssignment,
        (protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest | undefined),
        {} | undefined
    ]>;

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 IMoveAssignmentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IAssignment, (protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the assignment,
   *  e.g.
   *  `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
   */
  // const name = 'abc123'
  /**
   *  The new reservation ID, e.g.:
   *    `projects/myotherproject/locations/US/reservations/team2-prod`
   */
  // const destinationId = 'abc123'
  /**
   *  The optional assignment ID. A new assignment name is generated if this
   *  field is empty.
   *  This field can contain only lowercase alphanumeric characters or dashes.
   *  Max length is 64 characters.
   */
  // const assignmentId = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callMoveAssignment() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await reservationClient.moveAssignment(request);
    console.log(response);
  }

  callMoveAssignment();

moveAssignment(request, options, callback)

moveAssignment(request: protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IAssignment, protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IMoveAssignmentRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.IAssignment, protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

moveAssignment(request, callback)

moveAssignment(request: protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IAssignment, protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IMoveAssignmentRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.IAssignment, protos.google.cloud.bigquery.reservation.v1.IMoveAssignmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

projectPath(project)

projectPath(project: string): string;

Return a fully-qualified project resource name string.

Parameter
Name Description
project string
Returns
Type Description
string

{string} Resource name string.

reservationPath(project, location, reservation)

reservationPath(project: string, location: string, reservation: string): string;

Return a fully-qualified reservation resource name string.

Parameters
Name Description
project string
location string
reservation string
Returns
Type Description
string

{string} Resource name string.

searchAllAssignments(request, options)

searchAllAssignments(request?: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IAssignment[],
        protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest | null,
        protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse
    ]>;

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 ISearchAllAssignmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IAssignment[], protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest | null, protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using searchAllAssignmentsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

searchAllAssignments(request, options, callback)

searchAllAssignments(request: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IAssignment>): void;
Parameters
Name Description
request ISearchAllAssignmentsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IAssignment>
Returns
Type Description
void

searchAllAssignments(request, callback)

searchAllAssignments(request: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, callback: PaginationCallback<protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IAssignment>): void;
Parameters
Name Description
request ISearchAllAssignmentsRequest
callback PaginationCallback<protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IAssignment>
Returns
Type Description
void

searchAllAssignmentsAsync(request, options)

searchAllAssignmentsAsync(request?: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.bigquery.reservation.v1.IAssignment>;

Equivalent to searchAllAssignments, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request ISearchAllAssignmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.bigquery.reservation.v1.IAssignment>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name with location (project name could be the
   *  wildcard '-'), e.g.:
   *    `projects/-/locations/US`.
   */
  // const parent = 'abc123'
  /**
   *  Please specify resource name as assignee in the query.
   *  Examples:
   *  * `assignee=projects/myproject`
   *  * `assignee=folders/123`
   *  * `assignee=organizations/456`
   */
  // const query = 'abc123'
  /**
   *  The maximum number of items to return per page.
   */
  // const pageSize = 1234
  /**
   *  The next_page_token value returned from a previous List request, if any.
   */
  // const pageToken = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callSearchAllAssignments() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = reservationClient.searchAllAssignmentsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callSearchAllAssignments();

searchAllAssignmentsStream(request, options)

searchAllAssignmentsStream(request?: protos.google.cloud.bigquery.reservation.v1.ISearchAllAssignmentsRequest, options?: CallOptions): Transform;

Equivalent to searchAllAssignments, but returns a NodeJS Stream object.

Parameters
Name Description
request ISearchAllAssignmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using searchAllAssignmentsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

searchAssignments(request, options)

searchAssignments(request?: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IAssignment[],
        protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest | null,
        protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse
    ]>;

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 ISearchAssignmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IAssignment[], protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest | null, protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using searchAssignmentsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

searchAssignments(request, options, callback)

searchAssignments(request: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IAssignment>): void;
Parameters
Name Description
request ISearchAssignmentsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IAssignment>
Returns
Type Description
void

searchAssignments(request, callback)

searchAssignments(request: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, callback: PaginationCallback<protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IAssignment>): void;
Parameters
Name Description
request ISearchAssignmentsRequest
callback PaginationCallback<protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsResponse | null | undefined, protos.google.cloud.bigquery.reservation.v1.IAssignment>
Returns
Type Description
void

searchAssignmentsAsync(request, options)

searchAssignmentsAsync(request?: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.bigquery.reservation.v1.IAssignment>;

Equivalent to searchAssignments, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request ISearchAssignmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.bigquery.reservation.v1.IAssignment>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the admin project(containing project and
   *  location), e.g.:
   *    `projects/myproject/locations/US`.
   */
  // const parent = 'abc123'
  /**
   *  Please specify resource name as assignee in the query.
   *  Examples:
   *  * `assignee=projects/myproject`
   *  * `assignee=folders/123`
   *  * `assignee=organizations/456`
   */
  // const query = 'abc123'
  /**
   *  The maximum number of items to return per page.
   */
  // const pageSize = 1234
  /**
   *  The next_page_token value returned from a previous List request, if any.
   */
  // const pageToken = 'abc123'

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callSearchAssignments() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = reservationClient.searchAssignmentsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callSearchAssignments();

searchAssignmentsStream(request, options)

searchAssignmentsStream(request?: protos.google.cloud.bigquery.reservation.v1.ISearchAssignmentsRequest, options?: CallOptions): Transform;

Equivalent to searchAssignments, but returns a NodeJS Stream object.

Parameters
Name Description
request ISearchAssignmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using searchAssignmentsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

splitCapacityCommitment(request, options)

splitCapacityCommitment(request?: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse,
        (protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest | undefined),
        {} | undefined
    ]>;

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 ISplitCapacityCommitmentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, (protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing SplitCapacityCommitmentResponse. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name e.g.,:
   *   `projects/myproject/locations/US/capacityCommitments/123`
   */
  // const name = 'abc123'
  /**
   *  Number of slots in the capacity commitment after the split.
   */
  // const slotCount = 1234

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callSplitCapacityCommitment() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await reservationClient.splitCapacityCommitment(request);
    console.log(response);
  }

  callSplitCapacityCommitment();

splitCapacityCommitment(request, options, callback)

splitCapacityCommitment(request: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISplitCapacityCommitmentRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

splitCapacityCommitment(request, callback)

splitCapacityCommitment(request: protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISplitCapacityCommitmentRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentResponse, protos.google.cloud.bigquery.reservation.v1.ISplitCapacityCommitmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateAssignment(request, options)

updateAssignment(request?: protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IAssignment,
        (protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest | undefined),
        {} | undefined
    ]>;

Updates an existing assignment.

Only the priority field can be updated.

Parameters
Name Description
request IUpdateAssignmentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IAssignment, (protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Content of the assignment to update.
   */
  // const assignment = {}
  /**
   *  Standard field mask for the set of fields to be updated.
   */
  // const updateMask = {}

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callUpdateAssignment() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await reservationClient.updateAssignment(request);
    console.log(response);
  }

  callUpdateAssignment();

updateAssignment(request, options, callback)

updateAssignment(request: protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IAssignment, protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateAssignmentRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.IAssignment, protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateAssignment(request, callback)

updateAssignment(request: protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IAssignment, protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateAssignmentRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.IAssignment, protos.google.cloud.bigquery.reservation.v1.IUpdateAssignmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateBiReservation(request, options)

updateBiReservation(request?: protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IBiReservation,
        (protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest | undefined),
        {} | undefined
    ]>;

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 IUpdateBiReservationRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IBiReservation, (protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing BiReservation. Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  A reservation to update.
   */
  // const biReservation = {}
  /**
   *  A list of fields to be updated in this request.
   */
  // const updateMask = {}

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callUpdateBiReservation() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await reservationClient.updateBiReservation(request);
    console.log(response);
  }

  callUpdateBiReservation();

updateBiReservation(request, options, callback)

updateBiReservation(request: protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IBiReservation, protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateBiReservationRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.IBiReservation, protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateBiReservation(request, callback)

updateBiReservation(request: protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IBiReservation, protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateBiReservationRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.IBiReservation, protos.google.cloud.bigquery.reservation.v1.IUpdateBiReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateCapacityCommitment(request, options)

updateCapacityCommitment(request?: protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment,
        (protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest | undefined),
        {} | undefined
    ]>;

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 IUpdateCapacityCommitmentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, (protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Content of the capacity commitment to update.
   */
  // const capacityCommitment = {}
  /**
   *  Standard field mask for the set of fields to be updated.
   */
  // const updateMask = {}

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callUpdateCapacityCommitment() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await reservationClient.updateCapacityCommitment(request);
    console.log(response);
  }

  callUpdateCapacityCommitment();

updateCapacityCommitment(request, options, callback)

updateCapacityCommitment(request: protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateCapacityCommitmentRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateCapacityCommitment(request, callback)

updateCapacityCommitment(request: protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateCapacityCommitmentRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.ICapacityCommitment, protos.google.cloud.bigquery.reservation.v1.IUpdateCapacityCommitmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateReservation(request, options)

updateReservation(request?: protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.reservation.v1.IReservation,
        (protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest | undefined),
        {} | undefined
    ]>;

Updates an existing reservation resource.

Parameters
Name Description
request IUpdateReservationRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.reservation.v1.IReservation, (protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * 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.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Content of the reservation to update.
   */
  // const reservation = {}
  /**
   *  Standard field mask for the set of fields to be updated.
   */
  // const updateMask = {}

  // Imports the Reservation library
  const {ReservationServiceClient} = require('@google-cloud/bigquery-reservation').v1;

  // Instantiates a client
  const reservationClient = new ReservationServiceClient();

  async function callUpdateReservation() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await reservationClient.updateReservation(request);
    console.log(response);
  }

  callUpdateReservation();

updateReservation(request, options, callback)

updateReservation(request: protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateReservationRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateReservation(request, callback)

updateReservation(request: protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest, callback: Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateReservationRequest
callback Callback<protos.google.cloud.bigquery.reservation.v1.IReservation, protos.google.cloud.bigquery.reservation.v1.IUpdateReservationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void