Skip to content

Commit ae30a4e

Browse files
docs: [google-cloud-batch] Update description on allowed_locations in LocationPolicy field (#12650)
BEGIN_COMMIT_OVERRIDE docs: Update description on allowed_locations in LocationPolicy field END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. PiperOrigin-RevId: 629311450 Source-Link: googleapis/googleapis@869b3b2 Source-Link: googleapis/googleapis-gen@5ed7b07 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhdGNoLy5Pd2xCb3QueWFtbCIsImgiOiI1ZWQ3YjA3Nzg5ZmJhNTQ4MWU4YjBhMGE1N2RmYmUxMWM0OWFmNjQ3In0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <[email protected]>
1 parent 272fb7d commit ae30a4e

File tree

16 files changed

+2677
-398
lines changed

16 files changed

+2677
-398
lines changed

packages/google-cloud-batch/google/cloud/batch/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__ = "0.17.18" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-batch/google/cloud/batch_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__ = "0.17.18" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-batch/google/cloud/batch_v1/services/batch_service/async_client.py

Lines changed: 59 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import functools
1818
import re
1919
from typing import (
20+
Callable,
2021
Dict,
2122
Mapping,
2223
MutableMapping,
@@ -207,7 +208,9 @@ def __init__(
207208
self,
208209
*,
209210
credentials: Optional[ga_credentials.Credentials] = None,
210-
transport: Union[str, BatchServiceTransport] = "grpc_asyncio",
211+
transport: Optional[
212+
Union[str, BatchServiceTransport, Callable[..., BatchServiceTransport]]
213+
] = "grpc_asyncio",
211214
client_options: Optional[ClientOptions] = None,
212215
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
213216
) -> None:
@@ -219,9 +222,11 @@ def __init__(
219222
credentials identify the application to the service; if none
220223
are specified, the client will attempt to ascertain the
221224
credentials from the environment.
222-
transport (Union[str, ~.BatchServiceTransport]): The
223-
transport to use. If set to None, a transport is chosen
224-
automatically.
225+
transport (Optional[Union[str,BatchServiceTransport,Callable[..., BatchServiceTransport]]]):
226+
The transport to use, or a Callable that constructs and returns a new transport to use.
227+
If a Callable is given, it will be called with the same set of initialization
228+
arguments as used in the BatchServiceTransport constructor.
229+
If set to None, a transport is chosen automatically.
225230
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
226231
Custom options for the client.
227232
@@ -346,16 +351,19 @@ async def sample_create_job():
346351
The Cloud Batch Job description.
347352
"""
348353
# Create or coerce a protobuf request object.
349-
# Quick check: If we got a request object, we should *not* have
350-
# gotten any keyword arguments that map to the request.
354+
# - Quick check: If we got a request object, we should *not* have
355+
# gotten any keyword arguments that map to the request.
351356
has_flattened_params = any([parent, job, job_id])
352357
if request is not None and has_flattened_params:
353358
raise ValueError(
354359
"If the `request` argument is set, then none of "
355360
"the individual field arguments should be set."
356361
)
357362

358-
request = batch.CreateJobRequest(request)
363+
# - Use the request object if provided (there's no risk of modifying the input as
364+
# there are no flattened fields), or create one.
365+
if not isinstance(request, batch.CreateJobRequest):
366+
request = batch.CreateJobRequest(request)
359367

360368
# If we have keyword arguments corresponding to fields on the
361369
# request, apply these.
@@ -368,11 +376,9 @@ async def sample_create_job():
368376

369377
# Wrap the RPC method; this adds retry and timeout information,
370378
# and friendly error handling.
371-
rpc = gapic_v1.method_async.wrap_method(
372-
self._client._transport.create_job,
373-
default_timeout=60.0,
374-
client_info=DEFAULT_CLIENT_INFO,
375-
)
379+
rpc = self._client._transport._wrapped_methods[
380+
self._client._transport.create_job
381+
]
376382

377383
# Certain fields should be provided within the metadata header;
378384
# add these here.
@@ -450,16 +456,19 @@ async def sample_get_job():
450456
The Cloud Batch Job description.
451457
"""
452458
# Create or coerce a protobuf request object.
453-
# Quick check: If we got a request object, we should *not* have
454-
# gotten any keyword arguments that map to the request.
459+
# - Quick check: If we got a request object, we should *not* have
460+
# gotten any keyword arguments that map to the request.
455461
has_flattened_params = any([name])
456462
if request is not None and has_flattened_params:
457463
raise ValueError(
458464
"If the `request` argument is set, then none of "
459465
"the individual field arguments should be set."
460466
)
461467

462-
request = batch.GetJobRequest(request)
468+
# - Use the request object if provided (there's no risk of modifying the input as
469+
# there are no flattened fields), or create one.
470+
if not isinstance(request, batch.GetJobRequest):
471+
request = batch.GetJobRequest(request)
463472

464473
# If we have keyword arguments corresponding to fields on the
465474
# request, apply these.
@@ -468,20 +477,7 @@ async def sample_get_job():
468477

469478
# Wrap the RPC method; this adds retry and timeout information,
470479
# and friendly error handling.
471-
rpc = gapic_v1.method_async.wrap_method(
472-
self._client._transport.get_job,
473-
default_retry=retries.AsyncRetry(
474-
initial=1.0,
475-
maximum=10.0,
476-
multiplier=1.3,
477-
predicate=retries.if_exception_type(
478-
core_exceptions.ServiceUnavailable,
479-
),
480-
deadline=60.0,
481-
),
482-
default_timeout=60.0,
483-
client_info=DEFAULT_CLIENT_INFO,
484-
)
480+
rpc = self._client._transport._wrapped_methods[self._client._transport.get_job]
485481

486482
# Certain fields should be provided within the metadata header;
487483
# add these here.
@@ -574,16 +570,19 @@ async def sample_delete_job():
574570
575571
"""
576572
# Create or coerce a protobuf request object.
577-
# Quick check: If we got a request object, we should *not* have
578-
# gotten any keyword arguments that map to the request.
573+
# - Quick check: If we got a request object, we should *not* have
574+
# gotten any keyword arguments that map to the request.
579575
has_flattened_params = any([name])
580576
if request is not None and has_flattened_params:
581577
raise ValueError(
582578
"If the `request` argument is set, then none of "
583579
"the individual field arguments should be set."
584580
)
585581

586-
request = batch.DeleteJobRequest(request)
582+
# - Use the request object if provided (there's no risk of modifying the input as
583+
# there are no flattened fields), or create one.
584+
if not isinstance(request, batch.DeleteJobRequest):
585+
request = batch.DeleteJobRequest(request)
587586

588587
# If we have keyword arguments corresponding to fields on the
589588
# request, apply these.
@@ -592,11 +591,9 @@ async def sample_delete_job():
592591

593592
# Wrap the RPC method; this adds retry and timeout information,
594593
# and friendly error handling.
595-
rpc = gapic_v1.method_async.wrap_method(
596-
self._client._transport.delete_job,
597-
default_timeout=60.0,
598-
client_info=DEFAULT_CLIENT_INFO,
599-
)
594+
rpc = self._client._transport._wrapped_methods[
595+
self._client._transport.delete_job
596+
]
600597

601598
# Certain fields should be provided within the metadata header;
602599
# add these here.
@@ -687,16 +684,19 @@ async def sample_list_jobs():
687684
688685
"""
689686
# Create or coerce a protobuf request object.
690-
# Quick check: If we got a request object, we should *not* have
691-
# gotten any keyword arguments that map to the request.
687+
# - Quick check: If we got a request object, we should *not* have
688+
# gotten any keyword arguments that map to the request.
692689
has_flattened_params = any([parent])
693690
if request is not None and has_flattened_params:
694691
raise ValueError(
695692
"If the `request` argument is set, then none of "
696693
"the individual field arguments should be set."
697694
)
698695

699-
request = batch.ListJobsRequest(request)
696+
# - Use the request object if provided (there's no risk of modifying the input as
697+
# there are no flattened fields), or create one.
698+
if not isinstance(request, batch.ListJobsRequest):
699+
request = batch.ListJobsRequest(request)
700700

701701
# If we have keyword arguments corresponding to fields on the
702702
# request, apply these.
@@ -705,20 +705,9 @@ async def sample_list_jobs():
705705

706706
# Wrap the RPC method; this adds retry and timeout information,
707707
# and friendly error handling.
708-
rpc = gapic_v1.method_async.wrap_method(
709-
self._client._transport.list_jobs,
710-
default_retry=retries.AsyncRetry(
711-
initial=1.0,
712-
maximum=10.0,
713-
multiplier=1.3,
714-
predicate=retries.if_exception_type(
715-
core_exceptions.ServiceUnavailable,
716-
),
717-
deadline=60.0,
718-
),
719-
default_timeout=60.0,
720-
client_info=DEFAULT_CLIENT_INFO,
721-
)
708+
rpc = self._client._transport._wrapped_methods[
709+
self._client._transport.list_jobs
710+
]
722711

723712
# Certain fields should be provided within the metadata header;
724713
# add these here.
@@ -805,16 +794,19 @@ async def sample_get_task():
805794
A Cloud Batch task.
806795
"""
807796
# Create or coerce a protobuf request object.
808-
# Quick check: If we got a request object, we should *not* have
809-
# gotten any keyword arguments that map to the request.
797+
# - Quick check: If we got a request object, we should *not* have
798+
# gotten any keyword arguments that map to the request.
810799
has_flattened_params = any([name])
811800
if request is not None and has_flattened_params:
812801
raise ValueError(
813802
"If the `request` argument is set, then none of "
814803
"the individual field arguments should be set."
815804
)
816805

817-
request = batch.GetTaskRequest(request)
806+
# - Use the request object if provided (there's no risk of modifying the input as
807+
# there are no flattened fields), or create one.
808+
if not isinstance(request, batch.GetTaskRequest):
809+
request = batch.GetTaskRequest(request)
818810

819811
# If we have keyword arguments corresponding to fields on the
820812
# request, apply these.
@@ -823,20 +815,7 @@ async def sample_get_task():
823815

824816
# Wrap the RPC method; this adds retry and timeout information,
825817
# and friendly error handling.
826-
rpc = gapic_v1.method_async.wrap_method(
827-
self._client._transport.get_task,
828-
default_retry=retries.AsyncRetry(
829-
initial=1.0,
830-
maximum=10.0,
831-
multiplier=1.3,
832-
predicate=retries.if_exception_type(
833-
core_exceptions.ServiceUnavailable,
834-
),
835-
deadline=60.0,
836-
),
837-
default_timeout=60.0,
838-
client_info=DEFAULT_CLIENT_INFO,
839-
)
818+
rpc = self._client._transport._wrapped_methods[self._client._transport.get_task]
840819

841820
# Certain fields should be provided within the metadata header;
842821
# add these here.
@@ -923,16 +902,19 @@ async def sample_list_tasks():
923902
924903
"""
925904
# Create or coerce a protobuf request object.
926-
# Quick check: If we got a request object, we should *not* have
927-
# gotten any keyword arguments that map to the request.
905+
# - Quick check: If we got a request object, we should *not* have
906+
# gotten any keyword arguments that map to the request.
928907
has_flattened_params = any([parent])
929908
if request is not None and has_flattened_params:
930909
raise ValueError(
931910
"If the `request` argument is set, then none of "
932911
"the individual field arguments should be set."
933912
)
934913

935-
request = batch.ListTasksRequest(request)
914+
# - Use the request object if provided (there's no risk of modifying the input as
915+
# there are no flattened fields), or create one.
916+
if not isinstance(request, batch.ListTasksRequest):
917+
request = batch.ListTasksRequest(request)
936918

937919
# If we have keyword arguments corresponding to fields on the
938920
# request, apply these.
@@ -941,20 +923,9 @@ async def sample_list_tasks():
941923

942924
# Wrap the RPC method; this adds retry and timeout information,
943925
# and friendly error handling.
944-
rpc = gapic_v1.method_async.wrap_method(
945-
self._client._transport.list_tasks,
946-
default_retry=retries.AsyncRetry(
947-
initial=1.0,
948-
maximum=10.0,
949-
multiplier=1.3,
950-
predicate=retries.if_exception_type(
951-
core_exceptions.ServiceUnavailable,
952-
),
953-
deadline=60.0,
954-
),
955-
default_timeout=60.0,
956-
client_info=DEFAULT_CLIENT_INFO,
957-
)
926+
rpc = self._client._transport._wrapped_methods[
927+
self._client._transport.list_tasks
928+
]
958929

959930
# Certain fields should be provided within the metadata header;
960931
# add these here.

0 commit comments

Comments
 (0)