8000 chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this by gcf-owl-bot[bot] · Pull Request #72 · googleapis/python-run · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions google/cloud/run_v2/services/executions/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,6 @@ def __init__(
transport (Union[str, ExecutionsTransport]): The
transport to use. If set to None, a transport is chosen
automatically.
NOTE: "rest" transport functionality is currently in a
beta state (preview). We welcome your feedback via an
issue in this library's source repository.
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom opti 10000 ons for the
client. It won't take effect if a ``transport`` instance is provided.
(1) The ``api_endpoint`` property can be used to override the
Expand Down
81 changes: 42 additions & 39 deletions google/cloud/run_v2/services/executions/transports/rest.py
8000
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
rest_version=requests_version,
)

# TODO (numeric enums): This file was generated with the option to
# request that the server respond with enums JSON-encoded as
# numbers. The code below does not implement that functionality yet.


class ExecutionsRestInterceptor:
"""Interceptor for Executions.
Expand Down Expand Up @@ -255,9 +259,6 @@ class ExecutionsRestTransport(ExecutionsTransport):

It sends JSON representations of protocol buffers over HTTP/1.1

NOTE: This REST transport functionality is currently in a beta
state (preview). We welcome your feedback via an issue in this
library's source repository. Thank you!
"""

def __init__(
Expand All @@ -277,39 +278,35 @@ def __init__(
) -> None:
"""Instantiate the transport.

NOTE: This REST transport functionality is currently in a beta
state (preview). We welcome your feedback via a GitHub issue in
this library's repository. Thank you!

Args:
host (Optional[str]):
The hostname to connect to.
credentials (Optional[google.auth.credentials.Credentials]): The
authorization credentials to attach to requests. These
credentials identify the application to the service; if none
are specified, the client will attempt to ascertain the
credentials from the environment.

credentials_file (Optional[str]): A file with credentials that can
be loaded with :func:`google.auth.load_credentials_from_file`.
This argument is ignored if ``channel`` is provided.
scopes (Optional(Sequence[str])): A list of scopes. This argument is
ignored if ``channel`` is provided.
client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
certificate to configure mutual TLS HTTP channel. It is ignored
if ``channel`` is provided.
quota_project_id (Optional[str]): An optional project to use for billing
and quota.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you are developing
your own client library.
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
url_scheme: the protocol scheme for the API endpoint. Normally
"https", but for testing or local servers,
"http" can be specified.
Args:
host (Optional[str]):
The hostname to connect to.
credentials (Optional[google.auth.credentials.Credentials]): The
authorization credentials to attach to requests. These
credentials identify the application to the service; if none
are specified, the client will attempt to ascertain the
credentials from the environment.

credentials_file (Optional[str]): A file with credentials that can
be loaded with :func:`google.auth.load_credentials_from_file`.
This argument is ignored if ``channel`` is provided.
scopes (Optional(Sequence[str])): A list of scopes. This argument is
ignored if ``channel`` is provided.
client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
certificate to configure mutual TLS HTTP channel. It is ignored
if ``channel`` is provided.
quota_project_id (Optional[str]): An optional project to use for billing
and quota.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you are developing
your own client library.
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
url_scheme: the protocol scheme for the API endpoint. Normally
"https", but for testing or local servers,
"http" can be specified.
"""
# Run the base constructor
# TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
Expand Down Expand Up @@ -449,11 +446,13 @@ def __call__(
json_format.MessageToJson(
transcoded_request["query_params"],
including_default_value_fields=False,
use_integers_for_enums=False,
use_integers_for_enums=True,
)
)
query_params.update(self._get_unset_required_fields(query_params))

query_params["$alt"] = "json;enum-encoding=int"

# Send the request
headers = dict(metadata)
headers["Content-Type"] = "application/json"
Expand Down Expand Up @@ -538,11 +537,13 @@ def __call__(
json_format.MessageToJson(
transcoded_request["query_params"],
including_default_value_fields=False,
use_integers_for_enums=False,
use_integers_for_enums=True,
)
)
query_params.update(self._get_unset_required_fields(query_params))

query_params["$alt"] = "json;enum-encoding=int"

# Send the request
headers = dict(metadata)
headers["Content-Type"] = "application/json"
Expand Down Expand Up @@ -626,11 +627,13 @@ def __call__(
json_format.MessageToJson(
transcoded_request["query_params"],
including_default_value_fields=False,
use_integers_for_enums=False,
use_integers_for_enums=True,
)
)
query_params.update(self._get_unset_required_fields(query_params))

query_params["$alt"] = "json;enum-encoding=int"

# Send the request
headers = dict(metadata)
headers["Content-Type"] = "application/json"
Expand Down
3 changes: 0 additions & 3 deletions google/cloud/run_v2/services/jobs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,6 @@ def __init__(
transport (Union[str, JobsTransport]): The
transport to use. If set to None, a transport is chosen
automatically.
NOTE: "rest" transport functionality is currently in a
beta state (preview). We welcome your feedback via an
issue in this library's source repository.
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the
client. It won't take effect if a ``transport`` instance is provided.
(1) The ``api_endpoint`` property can be used to override the
Expand Down
Loading
0