Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

Commit f2c76e1

Browse files
fix: Removes accidentally exposed field service.traffic_tags_cleanup_threshold in Cloud Run Service (#130)
* feat: Adds support for cancel Execution feat: Adds support for Execution overrides feat: Adds support for Direct VPC egress setting feat: New fields for multi-container feat: New field for Task's scheduled timestamp docs: General documentation fixes. PiperOrigin-RevId: 567710896 Source-Link: googleapis/googleapis@c5985fe Source-Link: https://github.com/googleapis/googleapis-gen/commit/0e5c6ac7f359ba1776634e36c3c174ee72a07eac Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGU1YzZhYzdmMzU5YmExNzc2NjM0ZTM2YzNjMTc0ZWU3MmEwN2VhYyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix: Removes accidentally exposed field service.traffic_tags_cleanup_threshold in Cloud Run Service docs: Minor comment fixes PiperOrigin-RevId: 568981386 Source-Link: googleapis/googleapis@01711ae Source-Link: https://github.com/googleapis/googleapis-gen/commit/cc2e659f8cf5a458d6f7a2c0f8f7cfa54ef5402c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2MyZTY1OWY4Y2Y1YTQ1OGQ2ZjdhMmMwZjhmN2NmYTU0ZWY1NDAyYyJ9 * 🦉 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>
1 parent 0b5dc70 commit f2c76e1

24 files changed

+1750
-347
lines changed

google/cloud/run/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from google.cloud.run_v2.services.tasks.client import TasksClient
3131
from google.cloud.run_v2.types.condition import Condition
3232
from google.cloud.run_v2.types.execution import (
33+
CancelExecutionRequest,
3334
DeleteExecutionRequest,
3435
Execution,
3536
GetExecutionRequest,
@@ -52,6 +53,7 @@
5253
CloudSqlInstance,
5354
Container,
5455
ContainerPort,
56+
EmptyDirVolumeSource,
5557
EnvVar,
5658
EnvVarSource,
5759
GRPCAction,
@@ -117,6 +119,7 @@
117119
"TasksClient",
118120
"TasksAsyncClient",
119121
"Condition",
122+
"CancelExecutionRequest",
120123
"DeleteExecutionRequest",
121124
"Execution",
122125
"GetExecutionRequest",
@@ -135,6 +138,7 @@
135138
"CloudSqlInstance",
136139
"Container",
137140
"ContainerPort",
141+
"EmptyDirVolumeSource",
138142
"EnvVar",
139143
"EnvVarSource",
140144
"GRPCAction",

google/cloud/run_v2/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from .services.tasks import TasksAsyncClient, TasksClient
2626
from .types.condition import Condition
2727
from .types.execution import (
28+
CancelExecutionRequest,
2829
DeleteExecutionRequest,
2930
Execution,
3031
GetExecutionRequest,
@@ -47,6 +48,7 @@
4748
CloudSqlInstance,
4849
Container,
4950
ContainerPort,
51+
EmptyDirVolumeSource,
5052
EnvVar,
5153
EnvVarSource,
5254
GRPCAction,
@@ -107,6 +109,7 @@
107109
"ServicesAsyncClient",
108110
"TasksAsyncClient",
109111
"BinaryAuthorization",
112+
"CancelExecutionRequest",
110113
"CloudSqlInstance",
111114
"Condition",
112115
"Container",
@@ -117,6 +120,7 @@
117120
"DeleteJobRequest",
118121
"DeleteRevisionRequest",
119122
"DeleteServiceRequest",
123+
"EmptyDirVolumeSource",
120124
"EncryptionKeyRevocationAction",
121125
"EnvVar",
122126
"EnvVarSource",

google/cloud/run_v2/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
"grpc": {
1111
"libraryClient": "ExecutionsClient",
1212
"rpcs": {
13+
"CancelExecution": {
14+
"methods": [
15+
"cancel_execution"
16+
]
17+
},
1318
"DeleteExecution": {
1419
"methods": [
1520
"delete_execution"
@@ -30,6 +35,11 @@
3035
"grpc-async": {
3136
"libraryClient": "ExecutionsAsyncClient",
3237
"rpcs": {
38+
"CancelExecution": {
39+
"methods": [
40+
"cancel_execution"
41+
]
42+
},
3343
"DeleteExecution": {
3444
"methods": [
3545
"delete_execution"
@@ -50,6 +60,11 @@
5060
"rest": {
5161
"libraryClient": "ExecutionsClient",
5262
"rpcs": {
63+
"CancelExecution": {
64+
"methods": [
65+
"cancel_execution"
66+
]
67+
},
5368
"DeleteExecution": {
5469
"methods": [
5570
"delete_execution"

google/cloud/run_v2/services/executions/async_client.py

Lines changed: 128 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,9 @@ async def sample_get_execution():
267267
The request object. Request message for obtaining a
268268
Execution by its full name.
269269
name (:class:`str`):
270-
Required. The full name of the
271-
Execution. Format:
272-
273-
projects/{project}/locations/{location}/jobs/{job}/executions/{execution},
274-
where {project} can be project id or
275-
number.
270+
Required. The full name of the Execution. Format:
271+
``projects/{project}/locations/{location}/jobs/{job}/executions/{execution}``,
272+
where ``{project}`` can be project id or number.
276273
277274
This corresponds to the ``name`` field
278275
on the ``request`` instance; if ``request`` is provided, this
@@ -377,13 +374,11 @@ async def sample_list_executions():
377374
The request object. Request message for retrieving a list
378375
of Executions.
379376
parent (:class:`str`):
380-
Required. The Execution from which
381-
the Executions should be listed. To list
382-
all Executions across Jobs, use "-"
377+
Required. The Execution from which the Executions should
378+
be listed. To list all Executions across Jobs, use "-"
383379
instead of Job name. Format:
384-
projects/{project}/locations/{location}/jobs/{job},
385-
where {project} can be project id or
386-
number.
380+
``projects/{project}/locations/{location}/jobs/{job}``,
381+
where ``{project}`` can be project id or number.
387382
388383
This corresponds to the ``parent`` field
389384
on the ``request`` instance; if ``request`` is provided, this
@@ -500,12 +495,9 @@ async def sample_delete_execution():
500495
The request object. Request message for deleting an
501496
Execution.
502497
name (:class:`str`):
503-
Required. The name of the Execution
504-
to delete. Format:
505-
506-
projects/{project}/locations/{location}/jobs/{job}/executions/{execution},
507-
where {project} can be project id or
508-
number.
498+
Required. The name of the Execution to delete. Format:
499+
``projects/{project}/locations/{location}/jobs/{job}/executions/{execution}``,
500+
where ``{project}`` can be project id or number.
509501
510502
This corresponds to the ``name`` field
511503
on the ``request`` instance; if ``request`` is provided, this
@@ -575,6 +567,124 @@ async def sample_delete_execution():
575567
# Done; return the response.
576568
return response
577569

570+
async def cancel_execution(
571+
self,
572+
request: Optional[Union[execution.CancelExecutionRequest, dict]] = None,
573+
*,
574+
name: Optional[str] = None,
575+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
576+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
577+
metadata: Sequence[Tuple[str, str]] = (),
578+
) -> operation_async.AsyncOperation:
579+
r"""Cancels an Execution.
580+
581+
.. code-block:: python
582+
583+
# This snippet has been automatically generated and should be regarded as a
584+
# code template only.
585+
# It will require modifications to work:
586+
# - It may require correct/in-range values for request initialization.
587+
# - It may require specifying regional endpoints when creating the service
588+
# client as shown in:
589+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
590+
from google.cloud import run_v2
591+
592+
async def sample_cancel_execution():
593+
# Create a client
594+
client = run_v2.ExecutionsAsyncClient()
595+
596+
# Initialize request argument(s)
597+
request = run_v2.CancelExecutionRequest(
598+
name="name_value",
599+
)
600+
601+
# Make the request
602+
operation = client.cancel_execution(request=request)
603+
604+
print("Waiting for operation to complete...")
605+
606+
response = (await operation).result()
607+
608+
# Handle the response
609+
print(response)
610+
611+
Args:
612+
request (Optional[Union[google.cloud.run_v2.types.CancelExecutionRequest, dict]]):
613+
The request object. Request message for deleting an
614+
Execution.
615+
name (:class:`str`):
616+
Required. The name of the Execution to cancel. Format:
617+
``projects/{project}/locations/{location}/jobs/{job}/executions/{execution}``,
618+
where ``{project}`` can be project id or number.
619+
620+
This corresponds to the ``name`` field
621+
on the ``request`` instance; if ``request`` is provided, this
622+
should not be set.
623+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
624+
should be retried.
625+
timeout (float): The timeout for this request.
626+
metadata (Sequence[Tuple[str, str]]): Strings which should be
627+
sent along with the request as metadata.
628+
629+
Returns:
630+
google.api_core.operation_async.AsyncOperation:
631+
An object representing a long-running operation.
632+
633+
The result type for the operation will be :class:`google.cloud.run_v2.types.Execution` Execution represents the configuration of a single execution. A execution an
634+
immutable resource that references a container image
635+
which is run to completion.
636+
637+
"""
638+
# Create or coerce a protobuf request object.
639+
# Quick check: If we got a request object, we should *not* have
640+
# gotten any keyword arguments that map to the request.
641+
has_flattened_params = any([name])
642+
if request is not None and has_flattened_params:
643+
raise ValueError(
644+
"If the `request` argument is set, then none of "
645+
"the individual field arguments should be set."
646+
)
647+
648+
request = execution.CancelExecutionRequest(request)
649+
650+
# If we have keyword arguments corresponding to fields on the
651+
# request, apply these.
652+
if name is not None:
653+
request.name = name
654+
655+
# Wrap the RPC method; this adds retry and timeout information,
656+
# and friendly error handling.
657+
rpc = gapic_v1.method_async.wrap_method(
658+
self._client._transport.cancel_execution,
659+
default_timeout=None,
660+
client_info=DEFAULT_CLIENT_INFO,
661+
)
662+
663+
# Certain fields should be provided within the metadata header;
664+
# add these here.
665+
metadata = tuple(metadata) + (
666+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
667+
)
668+
669+
# Send the request.
670+
response = await rpc(
671+
request,
672+
retry=retry,
673+
timeout=timeout,
674+
metadata=metadata,
675+
)
676+
677+
# Wrap the response in an operation future.
678+
response = operation_async.from_gapic(
679+
response,
680+
self._client._transport.operations_client,
681+
execution.Execution,
682+
metadata_type=execution.Execution,
683+
)
684+
685+
# Done; return the response.
686+
return response
687+
578688
async def list_operations(
579689
self,
580690
request: Optional[operations_pb2.ListOperationsRequest] = None,

0 commit comments

Comments
 (0)