Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit 92c3ef2

Browse files
docs: minor formatting (#357)
* feat: increase timeout of RPC methods to 20s for v2 feat: add YAML config for GetLocation and ListLocation for v2 feat: add UploadQueueYaml, BufferTask RPC method for CloudTasks service for v2beta2 feat: set deadline for GetLocation, ListLocations and UploadQueueYaml RPCs for v2beta2 feat: add BufferTask RPC method for CloudTasks service for v2beta3 feat: add YAML config for GetLocation and ListLocations for v2beta3 PiperOrigin-RevId: 548738528 Source-Link: googleapis/googleapis@4d98ffc Source-Link: https://github.com/googleapis/googleapis-gen/commit/183d6bc4ee3c1890b1d24f9dc855041f497d5d5b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTgzZDZiYzRlZTNjMTg5MGIxZDI0ZjlkYzg1NTA0MWY0OTdkNWQ1YiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * docs: minor formatting PiperOrigin-RevId: 550624166 Source-Link: googleapis/googleapis@ff73e5d Source-Link: https://github.com/googleapis/googleapis-gen/commit/7254cdd571ec30b781b8b07550bd028e28690781 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzI1NGNkZDU3MWVjMzBiNzgxYjhiMDc1NTBiZDAyOGUyODY5MDc4MSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent e72007d commit 92c3ef2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+7386
-136
lines changed

google/cloud/tasks_v2/services/cloud_tasks/async_client.py

Lines changed: 135 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
except AttributeError: # pragma: NO COVER
4343
OptionalRetry = Union[retries.Retry, object] # type: ignore
4444

45+
from google.cloud.location import locations_pb2 # type: ignore
4546
from google.iam.v1 import iam_policy_pb2 # type: ignore
4647
from google.iam.v1 import policy_pb2 # type: ignore
4748
from google.protobuf import duration_pb2 # type: ignore
@@ -282,7 +283,7 @@ async def sample_list_queues():
282283
Returns:
283284
google.cloud.tasks_v2.services.cloud_tasks.pagers.ListQueuesAsyncPager:
284285
Response message for
285-
[ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues].
286+
[ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues].
286287
287288
Iterating over this object will yield results and
288289
resolve additional pages automatically.
@@ -317,9 +318,9 @@ async def sample_list_queues():
317318
core_exceptions.DeadlineExceeded,
318319
core_exceptions.ServiceUnavailable,
319320
),
320-
deadline=10.0,
321+
deadline=20.0,
321322
),
322-
default_timeout=10.0,
323+
default_timeout=20.0,
323324
client_info=DEFAULT_CLIENT_INFO,
324325
)
325326

@@ -442,9 +443,9 @@ async def sample_get_queue():
442443
core_exceptions.DeadlineExceeded,
443444
core_exceptions.ServiceUnavailable,
444445
),
445-
deadline=10.0,
446+
deadline=20.0,
446447
),
447-
default_timeout=10.0,
448+
default_timeout=20.0,
448449
client_info=DEFAULT_CLIENT_INFO,
449450
)
450451

@@ -577,7 +578,7 @@ async def sample_create_queue():
577578
# and friendly error handling.
578579
rpc = gapic_v1.method_async.wrap_method(
579580
self._client._transport.create_queue,
580-
default_timeout=10.0,
581+
default_timeout=20.0,
581582
client_info=DEFAULT_CLIENT_INFO,
582583
)
583584

@@ -715,7 +716,7 @@ async def sample_update_queue():
715716
# and friendly error handling.
716717
rpc = gapic_v1.method_async.wrap_method(
717718
self._client._transport.update_queue,
718-
default_timeout=10.0,
719+
default_timeout=20.0,
719720
client_info=DEFAULT_CLIENT_INFO,
720721
)
721722

@@ -829,9 +830,9 @@ async def sample_delete_queue():
829830
core_exceptions.DeadlineExceeded,
830831
core_exceptions.ServiceUnavailable,
831832
),
832-
deadline=10.0,
833+
deadline=20.0,
833834
),
834-
default_timeout=10.0,
835+
default_timeout=20.0,
835836
client_info=DEFAULT_CLIENT_INFO,
836837
)
837838

@@ -939,7 +940,7 @@ async def sample_purge_queue():
939940
# and friendly error handling.
940941
rpc = gapic_v1.method_async.wrap_method(
941942
self._client._transport.purge_queue,
942-
default_timeout=10.0,
943+
default_timeout=20.0,
943944
client_info=DEFAULT_CLIENT_INFO,
944945
)
945946

@@ -1052,7 +1053,7 @@ async def sample_pause_queue():
10521053
# and friendly error handling.
10531054
rpc = gapic_v1.method_async.wrap_method(
10541055
self._client._transport.pause_queue,
1055-
default_timeout=10.0,
1056+
default_timeout=20.0,
10561057
client_info=DEFAULT_CLIENT_INFO,
10571058
)
10581059

@@ -1172,7 +1173,7 @@ async def sample_resume_queue():
11721173
# and friendly error handling.
11731174
rpc = gapic_v1.method_async.wrap_method(
11741175
self._client._transport.resume_queue,
1175-
default_timeout=10.0,
1176+
default_timeout=20.0,
11761177
client_info=DEFAULT_CLIENT_INFO,
11771178
)
11781179

@@ -1353,9 +1354,9 @@ async def sample_get_iam_policy():
13531354
core_exceptions.DeadlineExceeded,
13541355
core_exceptions.ServiceUnavailable,
13551356
),
1356-
deadline=10.0,
1357+
deadline=20.0,
13571358
),
1358-
default_timeout=10.0,
1359+
default_timeout=20.0,
13591360
client_info=DEFAULT_CLIENT_INFO,
13601361
)
13611362

@@ -1532,7 +1533,7 @@ async def sample_set_iam_policy():
15321533
# and friendly error handling.
15331534
rpc = gapic_v1.method_async.wrap_method(
15341535
self._client._transport.set_iam_policy,
1535-
default_timeout=10.0,
1536+
default_timeout=20.0,
15361537
client_info=DEFAULT_CLIENT_INFO,
15371538
)
15381539

@@ -1664,9 +1665,9 @@ async def sample_test_iam_permissions():
16641665
core_exceptions.DeadlineExceeded,
16651666
core_exceptions.ServiceUnavailable,
16661667
),
1667-
deadline=10.0,
1668+
deadline=20.0,
16681669
),
1669-
default_timeout=10.0,
1670+
default_timeout=20.0,
16701671
client_info=DEFAULT_CLIENT_INFO,
16711672
)
16721673

@@ -1754,7 +1755,7 @@ async def sample_list_tasks():
17541755
Returns:
17551756
google.cloud.tasks_v2.services.cloud_tasks.pagers.ListTasksAsyncPager:
17561757
Response message for listing tasks using
1757-
[ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks].
1758+
[ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks].
17581759
17591760
Iterating over this object will yield results and
17601761
resolve additional pages automatically.
@@ -1789,9 +1790,9 @@ async def sample_list_tasks():
17891790
core_exceptions.DeadlineExceeded,
17901791
core_exceptions.ServiceUnavailable,
17911792
),
1792-
deadline=10.0,
1793+
deadline=20.0,
17931794
),
1794-
default_timeout=10.0,
1795+
default_timeout=20.0,
17951796
client_info=DEFAULT_CLIENT_INFO,
17961797
)
17971798

@@ -1908,9 +1909,9 @@ async def sample_get_task():
19081909
core_exceptions.DeadlineExceeded,
19091910
core_exceptions.ServiceUnavailable,
19101911
),
1911-
deadline=10.0,
1912+
deadline=20.0,
19121913
),
1913-
default_timeout=10.0,
1914+
default_timeout=20.0,
19141915
client_info=DEFAULT_CLIENT_INFO,
19151916
)
19161917

@@ -2066,7 +2067,7 @@ async def sample_create_task():
20662067
# and friendly error handling.
20672068
rpc = gapic_v1.method_async.wrap_method(
20682069
self._client._transport.create_task,
2069-
default_timeout=10.0,
2070+
default_timeout=20.0,
20702071
client_info=DEFAULT_CLIENT_INFO,
20712072
)
20722073

@@ -2170,9 +2171,9 @@ async def sample_delete_task():
21702171
core_exceptions.DeadlineExceeded,
21712172
core_exceptions.ServiceUnavailable,
21722173
),
2173-
deadline=10.0,
2174+
deadline=20.0,
21742175
),
2175-
default_timeout=10.0,
2176+
default_timeout=20.0,
21762177
client_info=DEFAULT_CLIENT_INFO,
21772178
)
21782179

@@ -2295,7 +2296,115 @@ async def sample_run_task():
22952296
# and friendly error handling.
22962297
rpc = gapic_v1.method_async.wrap_method(
22972298
self._client._transport.run_task,
2298-
default_timeout=10.0,
2299+
default_timeout=20.0,
2300+
client_info=DEFAULT_CLIENT_INFO,
2301+
)
2302+
2303+
# Certain fields should be provided within the metadata header;
2304+
# add these here.
2305+
metadata = tuple(metadata) + (
2306+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
2307+
)
2308+
2309+
# Send the request.
2310+
response = await rpc(
2311+
request,
2312+
retry=retry,
2313+
timeout=timeout,
2314+
metadata=metadata,
2315+
)
2316+
2317+
# Done; return the response.
2318+
return response
2319+
2320+
async def get_location(
2321+
self,
2322+
request: Optional[locations_pb2.GetLocationRequest] = None,
2323+
*,
2324+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2325+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2326+
metadata: Sequence[Tuple[str, str]] = (),
2327+
) -> locations_pb2.Location:
2328+
r"""Gets information about a location.
2329+
2330+
Args:
2331+
request (:class:`~.location_pb2.GetLocationRequest`):
2332+
The request object. Request message for
2333+
`GetLocation` method.
2334+
retry (google.api_core.retry.Retry): Designation of what errors,
2335+
if any, should be retried.
2336+
timeout (float): The timeout for this request.
2337+
metadata (Sequence[Tuple[str, str]]): Strings which should be
2338+
sent along with the request as metadata.
2339+
Returns:
2340+
~.location_pb2.Location:
2341+
Location object.
2342+
"""
2343+
# Create or coerce a protobuf request object.
2344+
# The request isn't a proto-plus wrapped type,
2345+
# so it must be constructed via keyword expansion.
2346+
if isinstance(request, dict):
2347+
request = locations_pb2.GetLocationRequest(**request)
2348+
2349+
# Wrap the RPC method; this adds retry and timeout information,
2350+
# and friendly error handling.
2351+
rpc = gapic_v1.method.wrap_method(
2352+
self._client._transport.get_location,
2353+
default_timeout=None,
2354+
client_info=DEFAULT_CLIENT_INFO,
2355+
)
2356+
2357+
# Certain fields should be provided within the metadata header;
2358+
# add these here.
2359+
metadata = tuple(metadata) + (
2360+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
2361+
)
2362+
2363+
# Send the request.
2364+
response = await rpc(
2365+
request,
2366+
retry=retry,
2367+
timeout=timeout,
2368+
metadata=metadata,
2369+
)
2370+
2371+
# Done; return the response.
2372+
return response
2373+
2374+
async def list_locations(
2375+
self,
2376+
request: Optional[locations_pb2.ListLocationsRequest] = None,
2377+
*,
2378+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2379+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2380+
metadata: Sequence[Tuple[str, str]] = (),
2381+
) -> locations_pb2.ListLocationsResponse:
2382+
r"""Lists information about the supported locations for this service.
2383+
2384+
Args:
2385+
request (:class:`~.location_pb2.ListLocationsRequest`):
2386+
The request object. Request message for
2387+
`ListLocations` method.
2388+
retry (google.api_core.retry.Retry): Designation of what errors,
2389+
if any, should be retried.
2390+
timeout (float): The timeout for this request.
2391+
metadata (Sequence[Tuple[str, str]]): Strings which should be
2392+
sent along with the request as metadata.
2393+
Returns:
2394+
~.location_pb2.ListLocationsResponse:
2395+
Response message for ``ListLocations`` method.
2396+
"""
2397+
# Create or coerce a protobuf request object.
2398+
# The request isn't a proto-plus wrapped type,
2399+
# so it must be constructed via keyword expansion.
2400+
if isinstance(request, dict):
2401+
request = locations_pb2.ListLocationsRequest(**request)
2402+
2403+
# Wrap the RPC method; this adds retry and timeout information,
2404+
# and friendly error handling.
2405+
rpc = gapic_v1.method.wrap_method(
2406+
self._client._transport.list_locations,
2407+
default_timeout=None,
22992408
client_info=DEFAULT_CLIENT_INFO,
23002409
)
23012410

0 commit comments

Comments
 (0)