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

Commit

Permalink
docs: minor formatting (#357)
Browse files Browse the repository at this point in the history
* 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 <partheniou@google.com>
  • Loading branch information
3 people authored Jul 25, 2023
1 parent e72007d commit 92c3ef2
Show file tree
Hide file tree
Showing 48 changed files with 7,386 additions and 136 deletions.
161 changes: 135 additions & 26 deletions google/cloud/tasks_v2/services/cloud_tasks/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore

from google.cloud.location import locations_pb2 # type: ignore
from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import duration_pb2 # type: ignore
Expand Down Expand Up @@ -282,7 +283,7 @@ async def sample_list_queues():
Returns:
google.cloud.tasks_v2.services.cloud_tasks.pagers.ListQueuesAsyncPager:
Response message for
[ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues].
[ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -317,9 +318,9 @@ async def sample_list_queues():
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=10.0,
deadline=20.0,
),
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -442,9 +443,9 @@ async def sample_get_queue():
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=10.0,
deadline=20.0,
),
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -577,7 +578,7 @@ async def sample_create_queue():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.create_queue,
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -715,7 +716,7 @@ async def sample_update_queue():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.update_queue,
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -829,9 +830,9 @@ async def sample_delete_queue():
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=10.0,
deadline=20.0,
),
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -939,7 +940,7 @@ async def sample_purge_queue():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.purge_queue,
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -1052,7 +1053,7 @@ async def sample_pause_queue():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.pause_queue,
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -1172,7 +1173,7 @@ async def sample_resume_queue():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.resume_queue,
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -1353,9 +1354,9 @@ async def sample_get_iam_policy():
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=10.0,
deadline=20.0,
),
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -1532,7 +1533,7 @@ async def sample_set_iam_policy():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.set_iam_policy,
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -1664,9 +1665,9 @@ async def sample_test_iam_permissions():
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=10.0,
deadline=20.0,
),
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -1754,7 +1755,7 @@ async def sample_list_tasks():
Returns:
google.cloud.tasks_v2.services.cloud_tasks.pagers.ListTasksAsyncPager:
Response message for listing tasks using
[ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks].
[ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -1789,9 +1790,9 @@ async def sample_list_tasks():
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=10.0,
deadline=20.0,
),
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -1908,9 +1909,9 @@ async def sample_get_task():
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=10.0,
deadline=20.0,
),
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -2066,7 +2067,7 @@ async def sample_create_task():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.create_task,
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -2170,9 +2171,9 @@ async def sample_delete_task():
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=10.0,
deadline=20.0,
),
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down Expand Up @@ -2295,7 +2296,115 @@ async def sample_run_task():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.run_task,
default_timeout=10.0,
default_timeout=20.0,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

async def get_location(
self,
request: Optional[locations_pb2.GetLocationRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> locations_pb2.Location:
r"""Gets information about a location.
Args:
request (:class:`~.location_pb2.GetLocationRequest`):
The request object. Request message for
`GetLocation` method.
retry (google.api_core.retry.Retry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
~.location_pb2.Location:
Location object.
"""
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = locations_pb2.GetLocationRequest(**request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._client._transport.get_location,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

async def list_locations(
self,
request: Optional[locations_pb2.ListLocationsRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> locations_pb2.ListLocationsResponse:
r"""Lists information about the supported locations for this service.
Args:
request (:class:`~.location_pb2.ListLocationsRequest`):
The request object. Request message for
`ListLocations` method.
retry (google.api_core.retry.Retry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
~.location_pb2.ListLocationsResponse:
Response message for ``ListLocations`` method.
"""
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = locations_pb2.ListLocationsRequest(**request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._client._transport.list_locations,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down
Loading

0 comments on commit 92c3ef2

Please sign in to comment.