Skip to content

Commit

Permalink
fix: Removes accidentally exposed field service.traffic_tags_cleanup_…
Browse files Browse the repository at this point in the history
…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: googleapis/googleapis-gen@0e5c6ac
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: googleapis/googleapis-gen@cc2e659
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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Sep 30, 2023
1 parent eb44d7c commit 9d5e2a2
Show file tree
Hide file tree
Showing 24 changed files with 1,750 additions and 347 deletions.
4 changes: 4 additions & 0 deletions packages/google-cloud-run/google/cloud/run/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from google.cloud.run_v2.services.tasks.client import TasksClient
from google.cloud.run_v2.types.condition import Condition
from google.cloud.run_v2.types.execution import (
CancelExecutionRequest,
DeleteExecutionRequest,
Execution,
GetExecutionRequest,
Expand All @@ -52,6 +53,7 @@
CloudSqlInstance,
Container,
ContainerPort,
EmptyDirVolumeSource,
EnvVar,
EnvVarSource,
GRPCAction,
Expand Down Expand Up @@ -117,6 +119,7 @@
"TasksClient",
"TasksAsyncClient",
"Condition",
"CancelExecutionRequest",
"DeleteExecutionRequest",
"Execution",
"GetExecutionRequest",
Expand All @@ -135,6 +138,7 @@
"CloudSqlInstance",
"Container",
"ContainerPort",
"EmptyDirVolumeSource",
"EnvVar",
"EnvVarSource",
"GRPCAction",
Expand Down
4 changes: 4 additions & 0 deletions packages/google-cloud-run/google/cloud/run_v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from .services.tasks import TasksAsyncClient, TasksClient
from .types.condition import Condition
from .types.execution import (
CancelExecutionRequest,
DeleteExecutionRequest,
Execution,
GetExecutionRequest,
Expand All @@ -47,6 +48,7 @@
CloudSqlInstance,
Container,
ContainerPort,
EmptyDirVolumeSource,
EnvVar,
EnvVarSource,
GRPCAction,
Expand Down Expand Up @@ -107,6 +109,7 @@
"ServicesAsyncClient",
"TasksAsyncClient",
"BinaryAuthorization",
"CancelExecutionRequest",
"CloudSqlInstance",
"Condition",
"Container",
Expand All @@ -117,6 +120,7 @@
"DeleteJobRequest",
"DeleteRevisionRequest",
"DeleteServiceRequest",
"EmptyDirVolumeSource",
"EncryptionKeyRevocationAction",
"EnvVar",
"EnvVarSource",
Expand Down
15 changes: 15 additions & 0 deletions packages/google-cloud-run/google/cloud/run_v2/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"grpc": {
"libraryClient": "ExecutionsClient",
"rpcs": {
"CancelExecution": {
"methods": [
"cancel_execution"
]
},
"DeleteExecution": {
"methods": [
"delete_execution"
Expand All @@ -30,6 +35,11 @@
"grpc-async": {
"libraryClient": "ExecutionsAsyncClient",
"rpcs": {
"CancelExecution": {
"methods": [
"cancel_execution"
]
},
"DeleteExecution": {
"methods": [
"delete_execution"
Expand All @@ -50,6 +60,11 @@
"rest": {
"libraryClient": "ExecutionsClient",
"rpcs": {
"CancelExecution": {
"methods": [
"cancel_execution"
]
},
"DeleteExecution": {
"methods": [
"delete_execution"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,9 @@ async def sample_get_execution():
The request object. Request message for obtaining a
Execution by its full name.
name (:class:`str`):
Required. The full name of the
Execution. Format:
projects/{project}/locations/{location}/jobs/{job}/executions/{execution},
where {project} can be project id or
number.
Required. The full name of the Execution. Format:
``projects/{project}/locations/{location}/jobs/{job}/executions/{execution}``,
where ``{project}`` can be project id or number.
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -377,13 +374,11 @@ async def sample_list_executions():
The request object. Request message for retrieving a list
of Executions.
parent (:class:`str`):
Required. The Execution from which
the Executions should be listed. To list
all Executions across Jobs, use "-"
Required. The Execution from which the Executions should
be listed. To list all Executions across Jobs, use "-"
instead of Job name. Format:
projects/{project}/locations/{location}/jobs/{job},
where {project} can be project id or
number.
``projects/{project}/locations/{location}/jobs/{job}``,
where ``{project}`` can be project id or number.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -500,12 +495,9 @@ async def sample_delete_execution():
The request object. Request message for deleting an
Execution.
name (:class:`str`):
Required. The name of the Execution
to delete. Format:
projects/{project}/locations/{location}/jobs/{job}/executions/{execution},
where {project} can be project id or
number.
Required. The name of the Execution to delete. Format:
``projects/{project}/locations/{location}/jobs/{job}/executions/{execution}``,
where ``{project}`` can be project id or number.
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -575,6 +567,124 @@ async def sample_delete_execution():
# Done; return the response.
return response

async def cancel_execution(
self,
request: Optional[Union[execution.CancelExecutionRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Cancels an Execution.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import run_v2
async def sample_cancel_execution():
# Create a client
client = run_v2.ExecutionsAsyncClient()
# Initialize request argument(s)
request = run_v2.CancelExecutionRequest(
name="name_value",
)
# Make the request
operation = client.cancel_execution(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Args:
request (Optional[Union[google.cloud.run_v2.types.CancelExecutionRequest, dict]]):
The request object. Request message for deleting an
Execution.
name (:class:`str`):
Required. The name of the Execution to cancel. Format:
``projects/{project}/locations/{location}/jobs/{job}/executions/{execution}``,
where ``{project}`` can be project id or number.
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
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:
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
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
immutable resource that references a container image
which is run to completion.
"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

request = execution.CancelExecutionRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if name is not None:
request.name = name

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.cancel_execution,
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,
)

# Wrap the response in an operation future.
response = operation_async.from_gapic(
response,
self._client._transport.operations_client,
execution.Execution,
metadata_type=execution.Execution,
)

# Done; return the response.
return response

async def list_operations(
self,
request: Optional[operations_pb2.ListOperationsRequest] = None,
Expand Down
Loading

0 comments on commit 9d5e2a2

Please sign in to comment.