Skip to content

Commit

Permalink
feat: Add the managed disaster recovery API(https://cloud.google.com/…
Browse files Browse the repository at this point in the history
…bigquery/docs/managed-disaster-recovery) (#7869)

feat: Add a new field `is_flat_rate` to `.google.cloud.bigquery.reservation.v1.CapacityCommitment` to distinguish between flat rate and edition commitments
docs: Clarify that `Autoscale.current_slots` in message `.google.cloud.bigquery.reservation.v1.Reservation` can temporarily be larger than `Autoscale.max_slots` if users reduce `Autoscale.max_slots`
docs: Update comment for `slot_capacity` in message `.google.cloud.bigquery.reservation.v1.Reservation` to provide more clarity about reservation baselines, committed slots and autoscaler SKU charges when the baseline exceeds committed slots
docs: Update comments for `commitment_start_time` and `commitment_end_time` in message `.google.cloud.bigquery.reservation.v1.CapacityCommitment` to provide details on how these values are affected by commitment renewal
PiperOrigin-RevId: 702079972
Source-Link: googleapis/googleapis@4743cf9
Source-Link: googleapis/googleapis-gen@30e9360
Copy-Tag: eyJwIjoiQmlnUXVlcnlSZXNlcnZhdGlvbi8uT3dsQm90LnlhbWwiLCJoIjoiMzBlOTM2MDAwYmZhYjk5YmYyODU2YmI4NDZhNTBlYjBlZTAzODViNyJ9
  • Loading branch information
gcf-owl-bot[bot] authored Dec 3, 2024
1 parent f826313 commit bcd09f1
Show file tree
Hide file tree
Showing 14 changed files with 617 additions and 62 deletions.
Binary file modified BigQueryReservation/metadata/V1/Reservation.php
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START bigqueryreservation_v1_generated_ReservationService_FailoverReservation_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\Reservation\V1\Client\ReservationServiceClient;
use Google\Cloud\BigQuery\Reservation\V1\FailoverReservationRequest;
use Google\Cloud\BigQuery\Reservation\V1\Reservation;

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

// Prepare the request message.
$request = (new FailoverReservationRequest())
->setName($formattedName);

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

/**
* Helper to execute the sample.
*
* 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]'
);

failover_reservation_sample($formattedName);
}
// [END bigqueryreservation_v1_generated_ReservationService_FailoverReservation_sync]
74 changes: 66 additions & 8 deletions BigQueryReservation/src/V1/CapacityCommitment.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions BigQueryReservation/src/V1/Client/ReservationServiceClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
use Google\Cloud\BigQuery\Reservation\V1\DeleteAssignmentRequest;
use Google\Cloud\BigQuery\Reservation\V1\DeleteCapacityCommitmentRequest;
use Google\Cloud\BigQuery\Reservation\V1\DeleteReservationRequest;
use Google\Cloud\BigQuery\Reservation\V1\FailoverReservationRequest;
use Google\Cloud\BigQuery\Reservation\V1\GetBiReservationRequest;
use Google\Cloud\BigQuery\Reservation\V1\GetCapacityCommitmentRequest;
use Google\Cloud\BigQuery\Reservation\V1\GetReservationRequest;
Expand Down Expand Up @@ -92,6 +93,7 @@
* @method PromiseInterface<void> deleteAssignmentAsync(DeleteAssignmentRequest $request, array $optionalArgs = [])
* @method PromiseInterface<void> deleteCapacityCommitmentAsync(DeleteCapacityCommitmentRequest $request, array $optionalArgs = [])
* @method PromiseInterface<void> deleteReservationAsync(DeleteReservationRequest $request, array $optionalArgs = [])
* @method PromiseInterface<Reservation> failoverReservationAsync(FailoverReservationRequest $request, array $optionalArgs = [])
* @method PromiseInterface<BiReservation> getBiReservationAsync(GetBiReservationRequest $request, array $optionalArgs = [])
* @method PromiseInterface<CapacityCommitment> getCapacityCommitmentAsync(GetCapacityCommitmentRequest $request, array $optionalArgs = [])
* @method PromiseInterface<Reservation> getReservationAsync(GetReservationRequest $request, array $optionalArgs = [])
Expand Down Expand Up @@ -559,6 +561,37 @@ public function deleteReservation(DeleteReservationRequest $request, array $call
$this->startApiCall('DeleteReservation', $request, $callOptions)->wait();
}

/**
* 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`.
*
* The async variant is {@see ReservationServiceClient::failoverReservationAsync()}
* .
*
* @example samples/V1/ReservationServiceClient/failover_reservation.php
*
* @param FailoverReservationRequest $request A request to house fields associated with the call.
* @param array $callOptions {
* Optional.
*
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
* associative array of retry settings parameters. See the documentation on
* {@see RetrySettings} for example usage.
* }
*
* @return Reservation
*
* @throws ApiException Thrown if the API call fails.
*/
public function failoverReservation(FailoverReservationRequest $request, array $callOptions = []): Reservation
{
return $this->startApiCall('FailoverReservation', $request, $callOptions)->wait();
}

/**
* Retrieves a BI reservation.
*
Expand Down
2 changes: 1 addition & 1 deletion BigQueryReservation/src/V1/Edition.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 71 additions & 0 deletions BigQueryReservation/src/V1/FailoverReservationRequest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bcd09f1

Please sign in to comment.