Skip to content

Commit e87d4e9

Browse files
feat: [google-cloud-bigquery-reservation] Add the managed disaster recovery API(https://cloud.google.com/bigquery/docs/managed-disaster-recovery) (#13316)
BEGIN_COMMIT_OVERRIDE feat: Add the managed disaster recovery API(https://cloud.google.com/bigquery/docs/managed-disaster-recovery) 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 END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. 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: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpZ3F1ZXJ5LXJlc2VydmF0aW9uLy5Pd2xCb3QueWFtbCIsImgiOiIzMGU5MzYwMDBiZmFiOTliZjI4NTZiYjg0NmE1MGViMGVlMDM4NWI3In0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent a33d01b commit e87d4e9

File tree

19 files changed

+1616
-72
lines changed

19 files changed

+1616
-72
lines changed

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
DeleteCapacityCommitmentRequest,
3636
DeleteReservationRequest,
3737
Edition,
38+
FailoverReservationRequest,
3839
GetBiReservationRequest,
3940
GetCapacityCommitmentRequest,
4041
GetReservationRequest,
@@ -72,6 +73,7 @@
7273
"DeleteAssignmentRequest",
7374
"DeleteCapacityCommitmentRequest",
7475
"DeleteReservationRequest",
76+
"FailoverReservationRequest",
7577
"GetBiReservationRequest",
7678
"GetCapacityCommitmentRequest",
7779
"GetReservationRequest",

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.14.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
DeleteCapacityCommitmentRequest,
3434
DeleteReservationRequest,
3535
Edition,
36+
FailoverReservationRequest,
3637
GetBiReservationRequest,
3738
GetCapacityCommitmentRequest,
3839
GetReservationRequest,
@@ -70,6 +71,7 @@
7071
"DeleteCapacityCommitmentRequest",
7172
"DeleteReservationRequest",
7273
"Edition",
74+
"FailoverReservationRequest",
7375
"GetBiReservationRequest",
7476
"GetCapacityCommitmentRequest",
7577
"GetReservationRequest",

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
"delete_reservation"
4141
]
4242
},
43+
"FailoverReservation": {
44+
"methods": [
45+
"failover_reservation"
46+
]
47+
},
4348
"GetBiReservation": {
4449
"methods": [
4550
"get_bi_reservation"
@@ -150,6 +155,11 @@
150155
"delete_reservation"
151156
]
152157
},
158+
"FailoverReservation": {
159+
"methods": [
160+
"failover_reservation"
161+
]
162+
},
153163
"GetBiReservation": {
154164
"methods": [
155165
"get_bi_reservation"
@@ -260,6 +270,11 @@
260270
"delete_reservation"
261271
]
262272
},
273+
"FailoverReservation": {
274+
"methods": [
275+
"failover_reservation"
276+
]
277+
},
263278
"GetBiReservation": {
264279
"methods": [
265280
"get_bi_reservation"

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.14.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/services/reservation_service/async_client.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,95 @@ async def sample_update_reservation():
868868
# Done; return the response.
869869
return response
870870

871+
async def failover_reservation(
872+
self,
873+
request: Optional[Union[reservation.FailoverReservationRequest, dict]] = None,
874+
*,
875+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
876+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
877+
metadata: Sequence[Tuple[str, str]] = (),
878+
) -> reservation.Reservation:
879+
r"""Fail over a reservation to the secondary location. The operation
880+
should be done in the current secondary location, which will be
881+
promoted to the new primary location for the reservation.
882+
Attempting to failover a reservation in the current primary
883+
location will fail with the error code
884+
``google.rpc.Code.FAILED_PRECONDITION``.
885+
886+
.. code-block:: python
887+
888+
# This snippet has been automatically generated and should be regarded as a
889+
# code template only.
890+
# It will require modifications to work:
891+
# - It may require correct/in-range values for request initialization.
892+
# - It may require specifying regional endpoints when creating the service
893+
# client as shown in:
894+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
895+
from google.cloud import bigquery_reservation_v1
896+
897+
async def sample_failover_reservation():
898+
# Create a client
899+
client = bigquery_reservation_v1.ReservationServiceAsyncClient()
900+
901+
# Initialize request argument(s)
902+
request = bigquery_reservation_v1.FailoverReservationRequest(
903+
name="name_value",
904+
)
905+
906+
# Make the request
907+
response = await client.failover_reservation(request=request)
908+
909+
# Handle the response
910+
print(response)
911+
912+
Args:
913+
request (Optional[Union[google.cloud.bigquery_reservation_v1.types.FailoverReservationRequest, dict]]):
914+
The request object. The request for
915+
ReservationService.FailoverReservation.
916+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
917+
should be retried.
918+
timeout (float): The timeout for this request.
919+
metadata (Sequence[Tuple[str, str]]): Strings which should be
920+
sent along with the request as metadata.
921+
922+
Returns:
923+
google.cloud.bigquery_reservation_v1.types.Reservation:
924+
A reservation is a mechanism used to
925+
guarantee slots to users.
926+
927+
"""
928+
# Create or coerce a protobuf request object.
929+
# - Use the request object if provided (there's no risk of modifying the input as
930+
# there are no flattened fields), or create one.
931+
if not isinstance(request, reservation.FailoverReservationRequest):
932+
request = reservation.FailoverReservationRequest(request)
933+
934+
# Wrap the RPC method; this adds retry and timeout information,
935+
# and friendly error handling.
936+
rpc = self._client._transport._wrapped_methods[
937+
self._client._transport.failover_reservation
938+
]
939+
940+
# Certain fields should be provided within the metadata header;
941+
# add these here.
942+
metadata = tuple(metadata) + (
943+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
944+
)
945+
946+
# Validate the universe domain.
947+
self._client._validate_universe_domain()
948+
949+
# Send the request.
950+
response = await rpc(
951+
request,
952+
retry=retry,
953+
timeout=timeout,
954+
metadata=metadata,
955+
)
956+
957+
# Done; return the response.
958+
return response
959+
871960
async def create_capacity_commitment(
872961
self,
873962
request: Optional[

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/services/reservation_service/client.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,93 @@ def sample_update_reservation():
12961296
# Done; return the response.
12971297
return response
12981298

1299+
def failover_reservation(
1300+
self,
1301+
request: Optional[Union[reservation.FailoverReservationRequest, dict]] = None,
1302+
*,
1303+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1304+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1305+
metadata: Sequence[Tuple[str, str]] = (),
1306+
) -> reservation.Reservation:
1307+
r"""Fail over a reservation to the secondary location. The operation
1308+
should be done in the current secondary location, which will be
1309+
promoted to the new primary location for the reservation.
1310+
Attempting to failover a reservation in the current primary
1311+
location will fail with the error code
1312+
``google.rpc.Code.FAILED_PRECONDITION``.
1313+
1314+
.. code-block:: python
1315+
1316+
# This snippet has been automatically generated and should be regarded as a
1317+
# code template only.
1318+
# It will require modifications to work:
1319+
# - It may require correct/in-range values for request initialization.
1320+
# - It may require specifying regional endpoints when creating the service
1321+
# client as shown in:
1322+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1323+
from google.cloud import bigquery_reservation_v1
1324+
1325+
def sample_failover_reservation():
1326+
# Create a client
1327+
client = bigquery_reservation_v1.ReservationServiceClient()
1328+
1329+
# Initialize request argument(s)
1330+
request = bigquery_reservation_v1.FailoverReservationRequest(
1331+
name="name_value",
1332+
)
1333+
1334+
# Make the request
1335+
response = client.failover_reservation(request=request)
1336+
1337+
# Handle the response
1338+
print(response)
1339+
1340+
Args:
1341+
request (Union[google.cloud.bigquery_reservation_v1.types.FailoverReservationRequest, dict]):
1342+
The request object. The request for
1343+
ReservationService.FailoverReservation.
1344+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1345+
should be retried.
1346+
timeout (float): The timeout for this request.
1347+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1348+
sent along with the request as metadata.
1349+
1350+
Returns:
1351+
google.cloud.bigquery_reservation_v1.types.Reservation:
1352+
A reservation is a mechanism used to
1353+
guarantee slots to users.
1354+
1355+
"""
1356+
# Create or coerce a protobuf request object.
1357+
# - Use the request object if provided (there's no risk of modifying the input as
1358+
# there are no flattened fields), or create one.
1359+
if not isinstance(request, reservation.FailoverReservationRequest):
1360+
request = reservation.FailoverReservationRequest(request)
1361+
1362+
# Wrap the RPC method; this adds retry and timeout information,
1363+
# and friendly error handling.
1364+
rpc = self._transport._wrapped_methods[self._transport.failover_reservation]
1365+
1366+
# Certain fields should be provided within the metadata header;
1367+
# add these here.
1368+
metadata = tuple(metadata) + (
1369+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1370+
)
1371+
1372+
# Validate the universe domain.
1373+
self._validate_universe_domain()
1374+
1375+
# Send the request.
1376+
response = rpc(
1377+
request,
1378+
retry=retry,
1379+
timeout=timeout,
1380+
metadata=metadata,
1381+
)
1382+
1383+
# Done; return the response.
1384+
return response
1385+
12991386
def create_capacity_commitment(
13001387
self,
13011388
request: Optional[

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/base.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ def _prep_wrapped_messages(self, client_info):
188188
default_timeout=300.0,
189189
client_info=client_info,
190190
),
191+
self.failover_reservation: gapic_v1.method.wrap_method(
192+
self.failover_reservation,
193+
default_timeout=None,
194+
client_info=client_info,
195+
),
191196
self.create_capacity_commitment: gapic_v1.method.wrap_method(
192197
self.create_capacity_commitment,
193198
default_timeout=300.0,
@@ -397,6 +402,15 @@ def update_reservation(
397402
]:
398403
raise NotImplementedError()
399404

405+
@property
406+
def failover_reservation(
407+
self,
408+
) -> Callable[
409+
[reservation.FailoverReservationRequest],
410+
Union[reservation.Reservation, Awaitable[reservation.Reservation]],
411+
]:
412+
raise NotImplementedError()
413+
400414
@property
401415
def create_capacity_commitment(
402416
self,

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/grpc.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,37 @@ def update_reservation(
390390
)
391391
return self._stubs["update_reservation"]
392392

393+
@property
394+
def failover_reservation(
395+
self,
396+
) -> Callable[[reservation.FailoverReservationRequest], reservation.Reservation]:
397+
r"""Return a callable for the failover reservation method over gRPC.
398+
399+
Fail over a reservation to the secondary location. The operation
400+
should be done in the current secondary location, which will be
401+
promoted to the new primary location for the reservation.
402+
Attempting to failover a reservation in the current primary
403+
location will fail with the error code
404+
``google.rpc.Code.FAILED_PRECONDITION``.
405+
406+
Returns:
407+
Callable[[~.FailoverReservationRequest],
408+
~.Reservation]:
409+
A function that, when called, will call the underlying RPC
410+
on the server.
411+
"""
412+
# Generate a "stub function" on-the-fly which will actually make
413+
# the request.
414+
# gRPC handles serialization and deserialization, so we just need
415+
# to pass in the functions for each.
416+
if "failover_reservation" not in self._stubs:
417+
self._stubs["failover_reservation"] = self.grpc_channel.unary_unary(
418+
"/google.cloud.bigquery.reservation.v1.ReservationService/FailoverReservation",
419+
request_serializer=reservation.FailoverReservationRequest.serialize,
420+
response_deserializer=reservation.Reservation.deserialize,
421+
)
422+
return self._stubs["failover_reservation"]
423+
393424
@property
394425
def create_capacity_commitment(
395426
self,

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/grpc_asyncio.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,39 @@ def update_reservation(
403403
)
404404
return self._stubs["update_reservation"]
405405

406+
@property
407+
def failover_reservation(
408+
self,
409+
) -> Callable[
410+
[reservation.FailoverReservationRequest], Awaitable[reservation.Reservation]
411+
]:
412+
r"""Return a callable for the failover reservation method over gRPC.
413+
414+
Fail over a reservation to the secondary location. The operation
415+
should be done in the current secondary location, which will be
416+
promoted to the new primary location for the reservation.
417+
Attempting to failover a reservation in the current primary
418+
location will fail with the error code
419+
``google.rpc.Code.FAILED_PRECONDITION``.
420+
421+
Returns:
422+
Callable[[~.FailoverReservationRequest],
423+
Awaitable[~.Reservation]]:
424+
A function that, when called, will call the underlying RPC
425+
on the server.
426+
"""
427+
# Generate a "stub function" on-the-fly which will actually make
428+
# the request.
429+
# gRPC handles serialization and deserialization, so we just need
430+
# to pass in the functions for each.
431+
if "failover_reservation" not in self._stubs:
432+
self._stubs["failover_reservation"] = self.grpc_channel.unary_unary(
433+
"/google.cloud.bigquery.reservation.v1.ReservationService/FailoverReservation",
434+
request_serializer=reservation.FailoverReservationRequest.serialize,
435+
response_deserializer=reservation.Reservation.deserialize,
436+
)
437+
return self._stubs["failover_reservation"]
438+
406439
@property
407440
def create_capacity_commitment(
408441
self,
@@ -1076,6 +1109,11 @@ def _prep_wrapped_messages(self, client_info):
10761109
default_timeout=300.0,
10771110
client_info=client_info,
10781111
),
1112+
self.failover_reservation: self._wrap_method(
1113+
self.failover_reservation,
1114+
default_timeout=None,
1115+
client_info=client_info,
1116+
),
10791117
self.create_capacity_commitment: self._wrap_method(
10801118
self.create_capacity_commitment,
10811119
default_timeout=300.0,

0 commit comments

Comments
 (0)