diff --git a/google/cloud/beyondcorp_clientconnectorservices_v1/services/client_connector_services_service/client.py b/google/cloud/beyondcorp_clientconnectorservices_v1/services/client_connector_services_service/client.py index 819b5a3..a0e3e82 100644 --- a/google/cloud/beyondcorp_clientconnectorservices_v1/services/client_connector_services_service/client.py +++ b/google/cloud/beyondcorp_clientconnectorservices_v1/services/client_connector_services_service/client.py @@ -393,9 +393,6 @@ def __init__( transport (Union[str, ClientConnectorServicesServiceTransport]): 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 diff --git a/google/cloud/beyondcorp_clientconnectorservices_v1/services/client_connector_services_service/transports/rest.py b/google/cloud/beyondcorp_clientconnectorservices_v1/services/client_connector_services_service/transports/rest.py index 5d87e31..1fa6beb 100644 --- a/google/cloud/beyondcorp_clientconnectorservices_v1/services/client_connector_services_service/transports/rest.py +++ b/google/cloud/beyondcorp_clientconnectorservices_v1/services/client_connector_services_service/transports/rest.py @@ -61,6 +61,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 ClientConnectorServicesServiceRestInterceptor: """Interceptor for ClientConnectorServicesService. @@ -487,9 +491,6 @@ class ClientConnectorServicesServiceRestTransport( 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__( @@ -509,39 +510,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. @@ -691,7 +688,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -701,11 +698,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" @@ -794,11 +793,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" @@ -887,11 +888,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" @@ -982,11 +985,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" @@ -1080,7 +1085,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1090,11 +1095,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" diff --git a/tests/unit/gapic/beyondcorp_clientconnectorservices_v1/test_client_connector_services_service.py b/tests/unit/gapic/beyondcorp_clientconnectorservices_v1/test_client_connector_services_service.py index 8be4aeb..d490b6f 100644 --- a/tests/unit/gapic/beyondcorp_clientconnectorservices_v1/test_client_connector_services_service.py +++ b/tests/unit/gapic/beyondcorp_clientconnectorservices_v1/test_client_connector_services_service.py @@ -2460,7 +2460,7 @@ def test_list_client_connector_services_rest_required_fields( response = client.list_client_connector_services(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -2835,7 +2835,7 @@ def test_get_client_connector_service_rest_required_fields( response = client.get_client_connector_service(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -3135,7 +3135,7 @@ def test_create_client_connector_service_rest_required_fields( response = client.create_client_connector_service(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -3470,7 +3470,7 @@ def test_update_client_connector_service_rest_required_fields( response = client.update_client_connector_service(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -3796,7 +3796,7 @@ def test_delete_client_connector_service_rest_required_fields( response = client.delete_client_connector_service(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params