Google BigQuery Reservation V1 Client - Class ReservationServiceClient (1.1.2)

Reference documentation and code samples for the Google BigQuery Reservation V1 Client class ReservationServiceClient.

Service Description: This API allows users to manage their BigQuery reservations.

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

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

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

$reservationServiceClient = new ReservationServiceClient();
try {
    $formattedParent = $reservationServiceClient->reservationName('[PROJECT]', '[LOCATION]', '[RESERVATION]');
    $response = $reservationServiceClient->createAssignment($formattedParent);
} finally {
    $reservationServiceClient->close();
}

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

Methods

assignmentName

Formats a string containing the fully-qualified path to represent a assignment resource.

Parameters
NameDescription
project string
location string
reservation string
assignment string
Returns
TypeDescription
stringThe formatted assignment resource.

biReservationName

Formats a string containing the fully-qualified path to represent a bi_reservation resource.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
stringThe formatted bi_reservation resource.

capacityCommitmentName

Formats a string containing the fully-qualified path to represent a capacity_commitment resource.

Parameters
NameDescription
project string
location string
capacityCommitment string
Returns
TypeDescription
stringThe formatted capacity_commitment resource.

locationName

Formats a string containing the fully-qualified path to represent a location resource.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
stringThe formatted location resource.

reservationName

Formats a string containing the fully-qualified path to represent a reservation resource.

Parameters
NameDescription
project string
location string
reservation string
Returns
TypeDescription
stringThe formatted reservation resource.

parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • assignment: projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}
  • biReservation: projects/{project}/locations/{location}/biReservation
  • capacityCommitment: projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}
  • location: projects/{project}/locations/{location}
  • reservation: projects/{project}/locations/{location}/reservations/{reservation}

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.

__construct

Constructor.

Parameters
NameDescription
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport string|TransportInterface

The transport used for executing network requests. May be either the string rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

createAssignment

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
NameDescription
parent string

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

optionalArgs array

Optional.

↳ assignment Assignment

Assignment resource to create.

↳ assignmentId string

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.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\Assignment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\Assignment;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedParent The parent resource name of the assignment
 *                                E.g. `projects/myproject/locations/US/reservations/team1-prod`
 *                                Please see {@see ReservationServiceClient::reservationName()} for help formatting this field.
 */
function create_assignment_sample(string $formattedParent): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var Assignment $response */
        $response = $reservationServiceClient->createAssignment($formattedParent);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = ReservationServiceClient::reservationName(
        '[PROJECT]',
        '[LOCATION]',
        '[RESERVATION]'
    );

    create_assignment_sample($formattedParent);
}

createCapacityCommitment

Creates a new capacity commitment resource.

Parameters
NameDescription
parent string

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

optionalArgs array

Optional.

↳ capacityCommitment CapacityCommitment

Content of the capacity commitment to create.

↳ enforceSingleAdminProjectPerOrg bool

If true, fail the request if another project in the organization has a capacity commitment.

↳ capacityCommitmentId string

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.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedParent Resource name of the parent reservation. E.g.,
 *                                `projects/myproject/locations/US`
 *                                Please see {@see ReservationServiceClient::locationName()} for help formatting this field.
 */
function create_capacity_commitment_sample(string $formattedParent): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var CapacityCommitment $response */
        $response = $reservationServiceClient->createCapacityCommitment($formattedParent);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = ReservationServiceClient::locationName('[PROJECT]', '[LOCATION]');

    create_capacity_commitment_sample($formattedParent);
}

createReservation

Creates a new reservation resource.

Parameters
NameDescription
parent string

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

optionalArgs array

Optional.

↳ reservationId string

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.

↳ reservation Reservation

Definition of the new reservation to create.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\Reservation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\Reservation;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedParent Project, location. E.g.,
 *                                `projects/myproject/locations/US`
 *                                Please see {@see ReservationServiceClient::locationName()} for help formatting this field.
 */
function create_reservation_sample(string $formattedParent): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var Reservation $response */
        $response = $reservationServiceClient->createReservation($formattedParent);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = ReservationServiceClient::locationName('[PROJECT]', '[LOCATION]');

    create_reservation_sample($formattedParent);
}

deleteAssignment

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
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedName Name of the resource, e.g.
 *                              `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
 *                              Please see {@see ReservationServiceClient::assignmentName()} for help formatting this field.
 */
function delete_assignment_sample(string $formattedName): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        $reservationServiceClient->deleteAssignment($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = ReservationServiceClient::assignmentName(
        '[PROJECT]',
        '[LOCATION]',
        '[RESERVATION]',
        '[ASSIGNMENT]'
    );

    delete_assignment_sample($formattedName);
}

deleteCapacityCommitment

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
NameDescription
name string

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

optionalArgs array

Optional.

↳ force bool

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.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedName Resource name of the capacity commitment to delete. E.g.,
 *                              `projects/myproject/locations/US/capacityCommitments/123`
 *                              Please see {@see ReservationServiceClient::capacityCommitmentName()} for help formatting this field.
 */
function delete_capacity_commitment_sample(string $formattedName): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        $reservationServiceClient->deleteCapacityCommitment($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = ReservationServiceClient::capacityCommitmentName(
        '[PROJECT]',
        '[LOCATION]',
        '[CAPACITY_COMMITMENT]'
    );

    delete_capacity_commitment_sample($formattedName);
}

deleteReservation

Deletes a reservation.

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

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedName Resource name of the reservation to retrieve. E.g.,
 *                              `projects/myproject/locations/US/reservations/team1-prod`
 *                              Please see {@see ReservationServiceClient::reservationName()} for help formatting this field.
 */
function delete_reservation_sample(string $formattedName): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        $reservationServiceClient->deleteReservation($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = ReservationServiceClient::reservationName(
        '[PROJECT]',
        '[LOCATION]',
        '[RESERVATION]'
    );

    delete_reservation_sample($formattedName);
}

getBiReservation

Retrieves a BI reservation.

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\BiReservation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\BiReservation;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedName Name of the requested reservation, for example:
 *                              `projects/{project_id}/locations/{location_id}/biReservation`
 *                              Please see {@see ReservationServiceClient::biReservationName()} for help formatting this field.
 */
function get_bi_reservation_sample(string $formattedName): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var BiReservation $response */
        $response = $reservationServiceClient->getBiReservation($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = ReservationServiceClient::biReservationName('[PROJECT]', '[LOCATION]');

    get_bi_reservation_sample($formattedName);
}

getCapacityCommitment

Returns information about the capacity commitment.

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedName Resource name of the capacity commitment to retrieve. E.g.,
 *                              `projects/myproject/locations/US/capacityCommitments/123`
 *                              Please see {@see ReservationServiceClient::capacityCommitmentName()} for help formatting this field.
 */
function get_capacity_commitment_sample(string $formattedName): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var CapacityCommitment $response */
        $response = $reservationServiceClient->getCapacityCommitment($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = ReservationServiceClient::capacityCommitmentName(
        '[PROJECT]',
        '[LOCATION]',
        '[CAPACITY_COMMITMENT]'
    );

    get_capacity_commitment_sample($formattedName);
}

getReservation

Returns information about the reservation.

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\Reservation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\Reservation;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedName Resource name of the reservation to retrieve. E.g.,
 *                              `projects/myproject/locations/US/reservations/team1-prod`
 *                              Please see {@see ReservationServiceClient::reservationName()} for help formatting this field.
 */
function get_reservation_sample(string $formattedName): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var Reservation $response */
        $response = $reservationServiceClient->getReservation($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = ReservationServiceClient::reservationName(
        '[PROJECT]',
        '[LOCATION]',
        '[RESERVATION]'
    );

    get_reservation_sample($formattedName);
}

listAssignments

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
NameDescription
parent string

Required. The parent resource name e.g.:

projects/myproject/locations/US/reservations/team1-prod

Or:

projects/myproject/locations/US/reservations/-

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BigQuery\Reservation\V1\Assignment;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedParent The parent resource name e.g.:
 *
 *                                `projects/myproject/locations/US/reservations/team1-prod`
 *
 *                                Or:
 *
 *                                `projects/myproject/locations/US/reservations/-`
 *                                Please see {@see ReservationServiceClient::reservationName()} for help formatting this field.
 */
function list_assignments_sample(string $formattedParent): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $reservationServiceClient->listAssignments($formattedParent);

        /** @var Assignment $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = ReservationServiceClient::reservationName(
        '[PROJECT]',
        '[LOCATION]',
        '[RESERVATION]'
    );

    list_assignments_sample($formattedParent);
}

listCapacityCommitments

Lists all the capacity commitments for the admin project.

Parameters
NameDescription
parent string

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

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedParent Resource name of the parent reservation. E.g.,
 *                                `projects/myproject/locations/US`
 *                                Please see {@see ReservationServiceClient::locationName()} for help formatting this field.
 */
function list_capacity_commitments_sample(string $formattedParent): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $reservationServiceClient->listCapacityCommitments($formattedParent);

        /** @var CapacityCommitment $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = ReservationServiceClient::locationName('[PROJECT]', '[LOCATION]');

    list_capacity_commitments_sample($formattedParent);
}

listReservations

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

Parameters
NameDescription
parent string

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

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BigQuery\Reservation\V1\Reservation;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedParent The parent resource name containing project and location, e.g.:
 *                                `projects/myproject/locations/US`
 *                                Please see {@see ReservationServiceClient::locationName()} for help formatting this field.
 */
function list_reservations_sample(string $formattedParent): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $reservationServiceClient->listReservations($formattedParent);

        /** @var Reservation $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = ReservationServiceClient::locationName('[PROJECT]', '[LOCATION]');

    list_reservations_sample($formattedParent);
}

mergeCapacityCommitments

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
NameDescription
optionalArgs array

Optional.

↳ parent string

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

↳ capacityCommitmentIds string[]

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

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function merge_capacity_commitments_sample(): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var CapacityCommitment $response */
        $response = $reservationServiceClient->mergeCapacityCommitments();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

moveAssignment

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
NameDescription
name string

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

optionalArgs array

Optional.

↳ destinationId string

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

↳ assignmentId string

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.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\Assignment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\Assignment;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedName The resource name of the assignment,
 *                              e.g.
 *                              `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
 *                              Please see {@see ReservationServiceClient::assignmentName()} for help formatting this field.
 */
function move_assignment_sample(string $formattedName): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var Assignment $response */
        $response = $reservationServiceClient->moveAssignment($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = ReservationServiceClient::assignmentName(
        '[PROJECT]',
        '[LOCATION]',
        '[RESERVATION]',
        '[ASSIGNMENT]'
    );

    move_assignment_sample($formattedName);
}

searchAllAssignments

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
NameDescription
parent string

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

optionalArgs array

Optional.

↳ query string

Please specify resource name as assignee in the query. Examples: * assignee=projects/myproject * assignee=folders/123 * assignee=organizations/456

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BigQuery\Reservation\V1\Assignment;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedParent The resource name with location (project name could be the
 *                                wildcard '-'), e.g.:
 *                                `projects/-/locations/US`. Please see
 *                                {@see ReservationServiceClient::locationName()} for help formatting this field.
 */
function search_all_assignments_sample(string $formattedParent): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $reservationServiceClient->searchAllAssignments($formattedParent);

        /** @var Assignment $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = ReservationServiceClient::locationName('[PROJECT]', '[LOCATION]');

    search_all_assignments_sample($formattedParent);
}

searchAssignments

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
NameDescription
parent string

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

optionalArgs array

Optional.

↳ query string

Please specify resource name as assignee in the query. Examples: * assignee=projects/myproject * assignee=folders/123 * assignee=organizations/456

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\BigQuery\Reservation\V1\Assignment;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * @param string $formattedParent The resource name of the admin project(containing project and
 *                                location), e.g.:
 *                                `projects/myproject/locations/US`. Please see
 *                                {@see ReservationServiceClient::locationName()} for help formatting this field.
 */
function search_assignments_sample(string $formattedParent): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $reservationServiceClient->searchAssignments($formattedParent);

        /** @var Assignment $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = ReservationServiceClient::locationName('[PROJECT]', '[LOCATION]');

    search_assignments_sample($formattedParent);
}

splitCapacityCommitment

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
NameDescription
name string

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

optionalArgs array

Optional.

↳ slotCount int

Number of slots in the capacity commitment after the split.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\SplitCapacityCommitmentResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;
use Google\Cloud\BigQuery\Reservation\V1\SplitCapacityCommitmentResponse;

/**
 * @param string $formattedName The resource name e.g.,:
 *                              `projects/myproject/locations/US/capacityCommitments/123`
 *                              Please see {@see ReservationServiceClient::capacityCommitmentName()} for help formatting this field.
 */
function split_capacity_commitment_sample(string $formattedName): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var SplitCapacityCommitmentResponse $response */
        $response = $reservationServiceClient->splitCapacityCommitment($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = ReservationServiceClient::capacityCommitmentName(
        '[PROJECT]',
        '[LOCATION]',
        '[CAPACITY_COMMITMENT]'
    );

    split_capacity_commitment_sample($formattedName);
}

updateAssignment

Updates an existing assignment.

Only the priority field can be updated.

Parameters
NameDescription
optionalArgs array

Optional.

↳ assignment Assignment

Content of the assignment to update.

↳ updateMask FieldMask

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

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\Assignment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\Assignment;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_assignment_sample(): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var Assignment $response */
        $response = $reservationServiceClient->updateAssignment();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateBiReservation

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
NameDescription
optionalArgs array

Optional.

↳ biReservation BiReservation

A reservation to update.

↳ updateMask FieldMask

A list of fields to be updated in this request.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\BiReservation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\BiReservation;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_bi_reservation_sample(): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var BiReservation $response */
        $response = $reservationServiceClient->updateBiReservation();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateCapacityCommitment

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
NameDescription
optionalArgs array

Optional.

↳ capacityCommitment CapacityCommitment

Content of the capacity commitment to update.

↳ updateMask FieldMask

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

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_capacity_commitment_sample(): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var CapacityCommitment $response */
        $response = $reservationServiceClient->updateCapacityCommitment();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateReservation

Updates an existing reservation resource.

Parameters
NameDescription
optionalArgs array

Optional.

↳ reservation Reservation

Content of the reservation to update.

↳ updateMask FieldMask

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

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\BigQuery\Reservation\V1\Reservation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\Reservation;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_reservation_sample(): void
{
    // Create a client.
    $reservationServiceClient = new ReservationServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var Reservation $response */
        $response = $reservationServiceClient->updateReservation();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

Constants

SERVICE_NAME

Value: 'google.cloud.bigquery.reservation.v1.ReservationService'

The name of the service.

SERVICE_ADDRESS

Value: 'bigqueryreservation.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

The name of the code generator, to be included in the agent header.