From f05eae5180b45ed8d4eab0a7655e8f330f2136af Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:13:27 +0000 Subject: [PATCH] feat: [google-cloud-orchestration-airflow] Add support for opt-in debug logging (#13322) BEGIN_COMMIT_OVERRIDE feat: Add support for opt-in debug logging fix: Fix typing issue with gRPC metadata when key ends in -bin chore: Update gapic-generator-python to v1.21.0 docs: add examples for kubernetes secret chore: explicitly set fields to field_behavior optional docs: A comment for field `data` in message `.google.cloud.orchestration.airflow.service.v1beta1.UserWorkloadsSecret` is changed docs: A comment for field `data` in message `.google.cloud.orchestration.airflow.service.v1beta1.UserWorkloadsConfigMap` is changed docs: A comment for field `software_config` in message `.google.cloud.orchestration.airflow.service.v1beta1.EnvironmentConfig` is changed docs: A comment for field `node_config` in message `.google.cloud.orchestration.airflow.service.v1beta1.EnvironmentConfig` is changed docs: A comment for field `private_environment_config` in message `.google.cloud.orchestration.airflow.service.v1beta1.EnvironmentConfig` is changed docs: A comment for field `image_version` in message `.google.cloud.orchestration.airflow.service.v1beta1.SoftwareConfig` is changed docs: A comment for field `name` in message `.google.cloud.orchestration.airflow.service.v1beta1.Environment` is changed docs: A comment for field `config` in message `.google.cloud.orchestration.airflow.service.v1beta1.Environment` is changed END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. fix: Fix typing issue with gRPC metadata when key ends in -bin chore: Update gapic-generator-python to v1.21.0 PiperOrigin-RevId: 705285820 Source-Link: https://github.com/googleapis/googleapis/commit/f9b8b9150f7fcd600b0acaeef91236b1843f5e49 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ca1e0a1e472d6e6f5de883a5cb54724f112ce348 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9yY2hlc3RyYXRpb24tYWlyZmxvdy8uT3dsQm90LnlhbWwiLCJoIjoiY2ExZTBhMWU0NzJkNmU2ZjVkZTg4M2E1Y2I1NDcyNGYxMTJjZTM0OCJ9 BEGIN_NESTED_COMMIT docs: [google-cloud-orchestration-airflow] add examples for kubernetes secret chore: explicitly set fields to field_behavior optional PiperOrigin-RevId: 703589766 Source-Link: https://github.com/googleapis/googleapis/commit/22dffa8f690606f58578f478e45172fbf7a06976 Source-Link: https://github.com/googleapis/googleapis-gen/commit/3a83c894fc43e34d7dc94ffa94727d4d5365b410 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9yY2hlc3RyYXRpb24tYWlyZmxvdy8uT3dsQm90LnlhbWwiLCJoIjoiM2E4M2M4OTRmYzQzZTM0ZDdkYzk0ZmZhOTQ3MjdkNGQ1MzY1YjQxMCJ9 END_NESTED_COMMIT BEGIN_NESTED_COMMIT docs: [google-cloud-orchestration-airflow] A comment for field `data` in message `.google.cloud.orchestration.airflow.service.v1beta1.UserWorkloadsSecret` is changed docs: A comment for field `data` in message `.google.cloud.orchestration.airflow.service.v1beta1.UserWorkloadsConfigMap` is changed docs: A comment for field `software_config` in message `.google.cloud.orchestration.airflow.service.v1beta1.EnvironmentConfig` is changed docs: A comment for field `node_config` in message `.google.cloud.orchestration.airflow.service.v1beta1.EnvironmentConfig` is changed docs: A comment for field `private_environment_config` in message `.google.cloud.orchestration.airflow.service.v1beta1.EnvironmentConfig` is changed docs: A comment for field `image_version` in message `.google.cloud.orchestration.airflow.service.v1beta1.SoftwareConfig` is changed docs: A comment for field `name` in message `.google.cloud.orchestration.airflow.service.v1beta1.Environment` is changed docs: A comment for field `config` in message `.google.cloud.orchestration.airflow.service.v1beta1.Environment` is changed PiperOrigin-RevId: 702414176 Source-Link: https://github.com/googleapis/googleapis/commit/0b0960363068a40a6b44001fb73e2bf018a200e6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/bdd2f7d11e7ae9d7bfc00aba2dcd240e944ba4a9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9yY2hlc3RyYXRpb24tYWlyZmxvdy8uT3dsQm90LnlhbWwiLCJoIjoiYmRkMmY3ZDExZTdhZTlkN2JmYzAwYWJhMmRjZDI0MGU5NDRiYTRhOSJ9 END_NESTED_COMMIT --------- Co-authored-by: Owl Bot Co-authored-by: ohmayr --- .../airflow/service/gapic_version.py | 2 +- .../airflow/service_v1/gapic_version.py | 2 +- .../services/environments/async_client.py | 248 ++- .../services/environments/client.py | 253 ++- .../services/environments/pagers.py | 64 +- .../services/environments/transports/grpc.py | 156 +- .../environments/transports/grpc_asyncio.py | 153 +- .../services/environments/transports/rest.py | 1696 ++++++++++++++-- .../services/image_versions/async_client.py | 64 +- .../services/image_versions/client.py | 69 +- .../services/image_versions/pagers.py | 16 +- .../image_versions/transports/grpc.py | 98 +- .../image_versions/transports/grpc_asyncio.py | 97 +- .../image_versions/transports/rest.py | 244 ++- .../airflow/service_v1/types/environments.py | 44 +- .../airflow/service_v1beta1/gapic_version.py | 2 +- .../services/environments/async_client.py | 256 ++- .../services/environments/client.py | 261 ++- .../services/environments/pagers.py | 64 +- .../services/environments/transports/grpc.py | 158 +- .../environments/transports/grpc_asyncio.py | 155 +- .../services/environments/transports/rest.py | 1760 +++++++++++++++-- .../services/image_versions/async_client.py | 64 +- .../services/image_versions/client.py | 69 +- .../services/image_versions/pagers.py | 16 +- .../image_versions/transports/grpc.py | 98 +- .../image_versions/transports/grpc_asyncio.py | 97 +- .../image_versions/transports/rest.py | 244 ++- .../service_v1beta1/types/environments.py | 44 +- ...loud.orchestration.airflow.service.v1.json | 102 +- ...orchestration.airflow.service.v1beta1.json | 106 +- .../gapic/service_v1/test_environments.py | 105 + .../gapic/service_v1/test_image_versions.py | 10 + .../service_v1beta1/test_environments.py | 108 + .../service_v1beta1/test_image_versions.py | 10 + 35 files changed, 5891 insertions(+), 1044 deletions(-) diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service/gapic_version.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service/gapic_version.py index 2fd2bb1630b4..558c8aab67c5 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service/gapic_version.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.15.1" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/gapic_version.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/gapic_version.py index 2fd2bb1630b4..558c8aab67c5 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/gapic_version.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.15.1" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/async_client.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/async_client.py index 2601c1bca362..64a9186c1e62 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/async_client.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/async_client.py @@ -14,6 +14,7 @@ # limitations under the License. # from collections import OrderedDict +import logging as std_logging import re from typing import ( Callable, @@ -58,6 +59,15 @@ from .transports.base import DEFAULT_CLIENT_INFO, EnvironmentsTransport from .transports.grpc_asyncio import EnvironmentsGrpcAsyncIOTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + class EnvironmentsAsyncClient: """Managed Apache Airflow Environments.""" @@ -271,6 +281,28 @@ def __init__( client_info=client_info, ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.cloud.orchestration.airflow.service_v1.EnvironmentsAsyncClient`.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "universeDomain": getattr( + self._client._transport._credentials, "universe_domain", "" + ), + "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", + "credentialsInfo": getattr( + self.transport._credentials, "get_cred_info", lambda: None + )(), + } + if hasattr(self._client._transport, "_credentials") + else { + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "credentialsType": None, + }, + ) + async def create_environment( self, request: Optional[Union[environments.CreateEnvironmentRequest, dict]] = None, @@ -279,7 +311,7 @@ async def create_environment( environment: Optional[environments.Environment] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Create a new environment. @@ -330,8 +362,10 @@ async def sample_create_environment(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -405,7 +439,7 @@ async def get_environment( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.Environment: r"""Get an existing environment. @@ -448,8 +482,10 @@ async def sample_get_environment(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.Environment: @@ -510,7 +546,7 @@ async def list_environments( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListEnvironmentsAsyncPager: r"""List environments. @@ -555,8 +591,10 @@ async def sample_list_environments(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListEnvironmentsAsyncPager: @@ -633,7 +671,7 @@ async def update_environment( update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Update an environment. @@ -871,8 +909,10 @@ async def sample_update_environment(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -948,7 +988,7 @@ async def delete_environment( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Delete an environment. @@ -995,8 +1035,10 @@ async def sample_delete_environment(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -1076,7 +1118,7 @@ async def execute_airflow_command( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ExecuteAirflowCommandResponse: r"""Executes Airflow CLI command. @@ -1111,8 +1153,10 @@ async def sample_execute_airflow_command(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.ExecuteAirflowCommandResponse: @@ -1160,7 +1204,7 @@ async def stop_airflow_command( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.StopAirflowCommandResponse: r"""Stops Airflow CLI command execution. @@ -1195,8 +1239,10 @@ async def sample_stop_airflow_command(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.StopAirflowCommandResponse: @@ -1244,7 +1290,7 @@ async def poll_airflow_command( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.PollAirflowCommandResponse: r"""Polls Airflow CLI command execution and fetches logs. @@ -1279,8 +1325,10 @@ async def sample_poll_airflow_command(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.PollAirflowCommandResponse: @@ -1329,7 +1377,7 @@ async def list_workloads( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListWorkloadsAsyncPager: r"""Lists workloads in a Cloud Composer environment. Workload is a unit that runs a single Composer component. @@ -1379,8 +1427,10 @@ async def sample_list_workloads(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListWorkloadsAsyncPager: @@ -1454,7 +1504,7 @@ async def check_upgrade( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Check if an upgrade operation on the environment will succeed. @@ -1498,8 +1548,10 @@ async def sample_check_upgrade(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -1561,7 +1613,7 @@ async def create_user_workloads_secret( user_workloads_secret: Optional[environments.UserWorkloadsSecret] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Creates a user workloads Secret. @@ -1615,8 +1667,10 @@ async def sample_create_user_workloads_secret(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsSecret: @@ -1682,7 +1736,7 @@ async def get_user_workloads_secret( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Gets an existing user workloads Secret. Values of the "data" field in the response are cleared. @@ -1730,8 +1784,10 @@ async def sample_get_user_workloads_secret(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsSecret: @@ -1795,7 +1851,7 @@ async def list_user_workloads_secrets( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListUserWorkloadsSecretsAsyncPager: r"""Lists user workloads Secrets. @@ -1843,8 +1899,10 @@ async def sample_list_user_workloads_secrets(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListUserWorkloadsSecretsAsyncPager: @@ -1921,7 +1979,7 @@ async def update_user_workloads_secret( user_workloads_secret: Optional[environments.UserWorkloadsSecret] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Updates a user workloads Secret. @@ -1966,8 +2024,10 @@ async def sample_update_user_workloads_secret(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsSecret: @@ -2033,7 +2093,7 @@ async def delete_user_workloads_secret( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a user workloads Secret. @@ -2077,8 +2137,10 @@ async def sample_delete_user_workloads_secret(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -2133,7 +2195,7 @@ async def create_user_workloads_config_map( user_workloads_config_map: Optional[environments.UserWorkloadsConfigMap] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Creates a user workloads ConfigMap. @@ -2188,8 +2250,10 @@ async def sample_create_user_workloads_config_map(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsConfigMap: @@ -2255,7 +2319,7 @@ async def get_user_workloads_config_map( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Gets an existing user workloads ConfigMap. @@ -2302,8 +2366,10 @@ async def sample_get_user_workloads_config_map(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsConfigMap: @@ -2367,7 +2433,7 @@ async def list_user_workloads_config_maps( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListUserWorkloadsConfigMapsAsyncPager: r"""Lists user workloads ConfigMaps. @@ -2416,8 +2482,10 @@ async def sample_list_user_workloads_config_maps(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListUserWorkloadsConfigMapsAsyncPager: @@ -2494,7 +2562,7 @@ async def update_user_workloads_config_map( user_workloads_config_map: Optional[environments.UserWorkloadsConfigMap] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Updates a user workloads ConfigMap. @@ -2540,8 +2608,10 @@ async def sample_update_user_workloads_config_map(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsConfigMap: @@ -2612,7 +2682,7 @@ async def delete_user_workloads_config_map( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a user workloads ConfigMap. @@ -2657,8 +2727,10 @@ async def sample_delete_user_workloads_config_map(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -2709,7 +2781,7 @@ async def save_snapshot( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Creates a snapshots of a Cloud Composer environment. @@ -2753,8 +2825,10 @@ async def sample_save_snapshot(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -2813,7 +2887,7 @@ async def load_snapshot( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Loads a snapshot of a Cloud Composer environment. @@ -2857,8 +2931,10 @@ async def sample_load_snapshot(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -2917,7 +2993,7 @@ async def database_failover( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Triggers database failover (only for highly resilient environments). @@ -2959,8 +3035,10 @@ async def sample_database_failover(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -3021,7 +3099,7 @@ async def fetch_database_properties( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.FetchDatabasePropertiesResponse: r"""Fetches database properties. @@ -3058,8 +3136,10 @@ async def sample_fetch_database_properties(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.FetchDatabasePropertiesResponse: @@ -3107,7 +3187,7 @@ async def list_operations( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -3118,8 +3198,10 @@ async def list_operations( retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.ListOperationsResponse: Response message for ``ListOperations`` method. @@ -3160,7 +3242,7 @@ async def get_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -3171,8 +3253,10 @@ async def get_operation( retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: An ``Operation`` object. @@ -3213,7 +3297,7 @@ async def delete_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a long-running operation. @@ -3229,8 +3313,10 @@ async def delete_operation( retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: None """ diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/client.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/client.py index f3bed8c1ab6a..251a247d5859 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/client.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/client.py @@ -14,6 +14,7 @@ # limitations under the License. # from collections import OrderedDict +import logging as std_logging import os import re from typing import ( @@ -50,6 +51,15 @@ except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore from google.longrunning import operations_pb2 # type: ignore @@ -635,6 +645,10 @@ def __init__( # Initialize the universe domain validation. self._is_universe_domain_valid = False + if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER + # Setup logging. + client_logging.initialize_logging() + api_key_value = getattr(self._client_options, "api_key", None) if api_key_value and credentials: raise ValueError( @@ -697,6 +711,29 @@ def __init__( api_audience=self._client_options.api_audience, ) + if "async" not in str(self._transport): + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.cloud.orchestration.airflow.service_v1.EnvironmentsClient`.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "universeDomain": getattr( + self._transport._credentials, "universe_domain", "" + ), + "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}", + "credentialsInfo": getattr( + self.transport._credentials, "get_cred_info", lambda: None + )(), + } + if hasattr(self._transport, "_credentials") + else { + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "credentialsType": None, + }, + ) + def create_environment( self, request: Optional[Union[environments.CreateEnvironmentRequest, dict]] = None, @@ -705,7 +742,7 @@ def create_environment( environment: Optional[environments.Environment] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Create a new environment. @@ -756,8 +793,10 @@ def sample_create_environment(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -828,7 +867,7 @@ def get_environment( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.Environment: r"""Get an existing environment. @@ -871,8 +910,10 @@ def sample_get_environment(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.Environment: @@ -930,7 +971,7 @@ def list_environments( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListEnvironmentsPager: r"""List environments. @@ -975,8 +1016,10 @@ def sample_list_environments(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListEnvironmentsPager: @@ -1050,7 +1093,7 @@ def update_environment( update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Update an environment. @@ -1288,8 +1331,10 @@ def sample_update_environment(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -1362,7 +1407,7 @@ def delete_environment( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Delete an environment. @@ -1409,8 +1454,10 @@ def sample_delete_environment(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -1487,7 +1534,7 @@ def execute_airflow_command( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ExecuteAirflowCommandResponse: r"""Executes Airflow CLI command. @@ -1522,8 +1569,10 @@ def sample_execute_airflow_command(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.ExecuteAirflowCommandResponse: @@ -1569,7 +1618,7 @@ def stop_airflow_command( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.StopAirflowCommandResponse: r"""Stops Airflow CLI command execution. @@ -1604,8 +1653,10 @@ def sample_stop_airflow_command(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.StopAirflowCommandResponse: @@ -1651,7 +1702,7 @@ def poll_airflow_command( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.PollAirflowCommandResponse: r"""Polls Airflow CLI command execution and fetches logs. @@ -1686,8 +1737,10 @@ def sample_poll_airflow_command(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.PollAirflowCommandResponse: @@ -1734,7 +1787,7 @@ def list_workloads( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListWorkloadsPager: r"""Lists workloads in a Cloud Composer environment. Workload is a unit that runs a single Composer component. @@ -1784,8 +1837,10 @@ def sample_list_workloads(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListWorkloadsPager: @@ -1856,7 +1911,7 @@ def check_upgrade( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Check if an upgrade operation on the environment will succeed. @@ -1900,8 +1955,10 @@ def sample_check_upgrade(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -1961,7 +2018,7 @@ def create_user_workloads_secret( user_workloads_secret: Optional[environments.UserWorkloadsSecret] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Creates a user workloads Secret. @@ -2015,8 +2072,10 @@ def sample_create_user_workloads_secret(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsSecret: @@ -2081,7 +2140,7 @@ def get_user_workloads_secret( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Gets an existing user workloads Secret. Values of the "data" field in the response are cleared. @@ -2129,8 +2188,10 @@ def sample_get_user_workloads_secret(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsSecret: @@ -2193,7 +2254,7 @@ def list_user_workloads_secrets( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListUserWorkloadsSecretsPager: r"""Lists user workloads Secrets. @@ -2241,8 +2302,10 @@ def sample_list_user_workloads_secrets(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListUserWorkloadsSecretsPager: @@ -2318,7 +2381,7 @@ def update_user_workloads_secret( user_workloads_secret: Optional[environments.UserWorkloadsSecret] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Updates a user workloads Secret. @@ -2363,8 +2426,10 @@ def sample_update_user_workloads_secret(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsSecret: @@ -2429,7 +2494,7 @@ def delete_user_workloads_secret( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a user workloads Secret. @@ -2473,8 +2538,10 @@ def sample_delete_user_workloads_secret(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -2528,7 +2595,7 @@ def create_user_workloads_config_map( user_workloads_config_map: Optional[environments.UserWorkloadsConfigMap] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Creates a user workloads ConfigMap. @@ -2583,8 +2650,10 @@ def sample_create_user_workloads_config_map(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsConfigMap: @@ -2649,7 +2718,7 @@ def get_user_workloads_config_map( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Gets an existing user workloads ConfigMap. @@ -2696,8 +2765,10 @@ def sample_get_user_workloads_config_map(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsConfigMap: @@ -2760,7 +2831,7 @@ def list_user_workloads_config_maps( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListUserWorkloadsConfigMapsPager: r"""Lists user workloads ConfigMaps. @@ -2809,8 +2880,10 @@ def sample_list_user_workloads_config_maps(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListUserWorkloadsConfigMapsPager: @@ -2886,7 +2959,7 @@ def update_user_workloads_config_map( user_workloads_config_map: Optional[environments.UserWorkloadsConfigMap] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Updates a user workloads ConfigMap. @@ -2932,8 +3005,10 @@ def sample_update_user_workloads_config_map(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsConfigMap: @@ -3003,7 +3078,7 @@ def delete_user_workloads_config_map( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a user workloads ConfigMap. @@ -3048,8 +3123,10 @@ def sample_delete_user_workloads_config_map(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -3099,7 +3176,7 @@ def save_snapshot( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Creates a snapshots of a Cloud Composer environment. @@ -3143,8 +3220,10 @@ def sample_save_snapshot(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -3201,7 +3280,7 @@ def load_snapshot( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Loads a snapshot of a Cloud Composer environment. @@ -3245,8 +3324,10 @@ def sample_load_snapshot(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -3303,7 +3384,7 @@ def database_failover( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Triggers database failover (only for highly resilient environments). @@ -3345,8 +3426,10 @@ def sample_database_failover(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -3405,7 +3488,7 @@ def fetch_database_properties( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.FetchDatabasePropertiesResponse: r"""Fetches database properties. @@ -3442,8 +3525,10 @@ def sample_fetch_database_properties(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.types.FetchDatabasePropertiesResponse: @@ -3504,7 +3589,7 @@ def list_operations( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -3515,8 +3600,10 @@ def list_operations( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.ListOperationsResponse: Response message for ``ListOperations`` method. @@ -3557,7 +3644,7 @@ def get_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -3568,8 +3655,10 @@ def get_operation( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: An ``Operation`` object. @@ -3610,7 +3699,7 @@ def delete_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a long-running operation. @@ -3626,8 +3715,10 @@ def delete_operation( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: None """ diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/pagers.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/pagers.py index e183964e141b..170bba0da9fb 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/pagers.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/pagers.py @@ -67,7 +67,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -81,8 +81,10 @@ def __init__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListEnvironmentsRequest(request) @@ -141,7 +143,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -155,8 +157,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListEnvironmentsRequest(request) @@ -219,7 +223,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -233,8 +237,10 @@ def __init__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListWorkloadsRequest(request) @@ -293,7 +299,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -307,8 +313,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListWorkloadsRequest(request) @@ -373,7 +381,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -387,8 +395,10 @@ def __init__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListUserWorkloadsSecretsRequest(request) @@ -447,7 +457,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -461,8 +471,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListUserWorkloadsSecretsRequest(request) @@ -527,7 +539,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -541,8 +553,10 @@ def __init__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListUserWorkloadsConfigMapsRequest(request) @@ -603,7 +617,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -617,8 +631,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListUserWorkloadsConfigMapsRequest(request) diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/grpc.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/grpc.py index 1d424d9d8162..1c5c69304de2 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/grpc.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/grpc.py @@ -13,6 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import json +import logging as std_logging +import pickle from typing import Callable, Dict, Optional, Sequence, Tuple, Union import warnings @@ -22,12 +25,90 @@ from google.auth.transport.grpc import SslCredentials # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.orchestration.airflow.service_v1.types import environments from .base import DEFAULT_CLIENT_INFO, EnvironmentsTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER + def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": client_call_details.method, + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + + response = continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = ( + dict([(k, str(v)) for k, v in response_metadata]) + if response_metadata + else None + ) + result = response.result() + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response for {client_call_details.method}.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class EnvironmentsGrpcTransport(EnvironmentsTransport): """gRPC backend transport for Environments. @@ -182,7 +263,12 @@ def __init__( ], ) - # Wrap messages. This must be done after self._grpc_channel exists + self._interceptor = _LoggingClientInterceptor() + self._logged_channel = grpc.intercept_channel( + self._grpc_channel, self._interceptor + ) + + # Wrap messages. This must be done after self._logged_channel exists self._prep_wrapped_messages(client_info) @classmethod @@ -246,7 +332,9 @@ def operations_client(self) -> operations_v1.OperationsClient: """ # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient(self.grpc_channel) + self._operations_client = operations_v1.OperationsClient( + self._logged_channel + ) # Return the client from cache. return self._operations_client @@ -270,7 +358,7 @@ def create_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_environment" not in self._stubs: - self._stubs["create_environment"] = self.grpc_channel.unary_unary( + self._stubs["create_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/CreateEnvironment", request_serializer=environments.CreateEnvironmentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -296,7 +384,7 @@ def get_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_environment" not in self._stubs: - self._stubs["get_environment"] = self.grpc_channel.unary_unary( + self._stubs["get_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/GetEnvironment", request_serializer=environments.GetEnvironmentRequest.serialize, response_deserializer=environments.Environment.deserialize, @@ -324,7 +412,7 @@ def list_environments( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_environments" not in self._stubs: - self._stubs["list_environments"] = self.grpc_channel.unary_unary( + self._stubs["list_environments"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/ListEnvironments", request_serializer=environments.ListEnvironmentsRequest.serialize, response_deserializer=environments.ListEnvironmentsResponse.deserialize, @@ -350,7 +438,7 @@ def update_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_environment" not in self._stubs: - self._stubs["update_environment"] = self.grpc_channel.unary_unary( + self._stubs["update_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/UpdateEnvironment", request_serializer=environments.UpdateEnvironmentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -376,7 +464,7 @@ def delete_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_environment" not in self._stubs: - self._stubs["delete_environment"] = self.grpc_channel.unary_unary( + self._stubs["delete_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/DeleteEnvironment", request_serializer=environments.DeleteEnvironmentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -405,7 +493,7 @@ def execute_airflow_command( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "execute_airflow_command" not in self._stubs: - self._stubs["execute_airflow_command"] = self.grpc_channel.unary_unary( + self._stubs["execute_airflow_command"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/ExecuteAirflowCommand", request_serializer=environments.ExecuteAirflowCommandRequest.serialize, response_deserializer=environments.ExecuteAirflowCommandResponse.deserialize, @@ -434,7 +522,7 @@ def stop_airflow_command( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stop_airflow_command" not in self._stubs: - self._stubs["stop_airflow_command"] = self.grpc_channel.unary_unary( + self._stubs["stop_airflow_command"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/StopAirflowCommand", request_serializer=environments.StopAirflowCommandRequest.serialize, response_deserializer=environments.StopAirflowCommandResponse.deserialize, @@ -463,7 +551,7 @@ def poll_airflow_command( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "poll_airflow_command" not in self._stubs: - self._stubs["poll_airflow_command"] = self.grpc_channel.unary_unary( + self._stubs["poll_airflow_command"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/PollAirflowCommand", request_serializer=environments.PollAirflowCommandRequest.serialize, response_deserializer=environments.PollAirflowCommandResponse.deserialize, @@ -495,7 +583,7 @@ def list_workloads( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_workloads" not in self._stubs: - self._stubs["list_workloads"] = self.grpc_channel.unary_unary( + self._stubs["list_workloads"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/ListWorkloads", request_serializer=environments.ListWorkloadsRequest.serialize, response_deserializer=environments.ListWorkloadsResponse.deserialize, @@ -524,7 +612,7 @@ def check_upgrade( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "check_upgrade" not in self._stubs: - self._stubs["check_upgrade"] = self.grpc_channel.unary_unary( + self._stubs["check_upgrade"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/CheckUpgrade", request_serializer=environments.CheckUpgradeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -556,7 +644,9 @@ def create_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_user_workloads_secret" not in self._stubs: - self._stubs["create_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_user_workloads_secret" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/CreateUserWorkloadsSecret", request_serializer=environments.CreateUserWorkloadsSecretRequest.serialize, response_deserializer=environments.UserWorkloadsSecret.deserialize, @@ -588,7 +678,7 @@ def get_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_user_workloads_secret" not in self._stubs: - self._stubs["get_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs["get_user_workloads_secret"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/GetUserWorkloadsSecret", request_serializer=environments.GetUserWorkloadsSecretRequest.serialize, response_deserializer=environments.UserWorkloadsSecret.deserialize, @@ -620,7 +710,9 @@ def list_user_workloads_secrets( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_user_workloads_secrets" not in self._stubs: - self._stubs["list_user_workloads_secrets"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_user_workloads_secrets" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/ListUserWorkloadsSecrets", request_serializer=environments.ListUserWorkloadsSecretsRequest.serialize, response_deserializer=environments.ListUserWorkloadsSecretsResponse.deserialize, @@ -652,7 +744,9 @@ def update_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_user_workloads_secret" not in self._stubs: - self._stubs["update_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_user_workloads_secret" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/UpdateUserWorkloadsSecret", request_serializer=environments.UpdateUserWorkloadsSecretRequest.serialize, response_deserializer=environments.UserWorkloadsSecret.deserialize, @@ -681,7 +775,9 @@ def delete_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_user_workloads_secret" not in self._stubs: - self._stubs["delete_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_user_workloads_secret" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/DeleteUserWorkloadsSecret", request_serializer=environments.DeleteUserWorkloadsSecretRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -716,7 +812,7 @@ def create_user_workloads_config_map( if "create_user_workloads_config_map" not in self._stubs: self._stubs[ "create_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/CreateUserWorkloadsConfigMap", request_serializer=environments.CreateUserWorkloadsConfigMapRequest.serialize, response_deserializer=environments.UserWorkloadsConfigMap.deserialize, @@ -750,7 +846,7 @@ def get_user_workloads_config_map( if "get_user_workloads_config_map" not in self._stubs: self._stubs[ "get_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/GetUserWorkloadsConfigMap", request_serializer=environments.GetUserWorkloadsConfigMapRequest.serialize, response_deserializer=environments.UserWorkloadsConfigMap.deserialize, @@ -785,7 +881,7 @@ def list_user_workloads_config_maps( if "list_user_workloads_config_maps" not in self._stubs: self._stubs[ "list_user_workloads_config_maps" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/ListUserWorkloadsConfigMaps", request_serializer=environments.ListUserWorkloadsConfigMapsRequest.serialize, response_deserializer=environments.ListUserWorkloadsConfigMapsResponse.deserialize, @@ -820,7 +916,7 @@ def update_user_workloads_config_map( if "update_user_workloads_config_map" not in self._stubs: self._stubs[ "update_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/UpdateUserWorkloadsConfigMap", request_serializer=environments.UpdateUserWorkloadsConfigMapRequest.serialize, response_deserializer=environments.UserWorkloadsConfigMap.deserialize, @@ -852,7 +948,7 @@ def delete_user_workloads_config_map( if "delete_user_workloads_config_map" not in self._stubs: self._stubs[ "delete_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/DeleteUserWorkloadsConfigMap", request_serializer=environments.DeleteUserWorkloadsConfigMapRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -882,7 +978,7 @@ def save_snapshot( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "save_snapshot" not in self._stubs: - self._stubs["save_snapshot"] = self.grpc_channel.unary_unary( + self._stubs["save_snapshot"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/SaveSnapshot", request_serializer=environments.SaveSnapshotRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -912,7 +1008,7 @@ def load_snapshot( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "load_snapshot" not in self._stubs: - self._stubs["load_snapshot"] = self.grpc_channel.unary_unary( + self._stubs["load_snapshot"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/LoadSnapshot", request_serializer=environments.LoadSnapshotRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -939,7 +1035,7 @@ def database_failover( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "database_failover" not in self._stubs: - self._stubs["database_failover"] = self.grpc_channel.unary_unary( + self._stubs["database_failover"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/DatabaseFailover", request_serializer=environments.DatabaseFailoverRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -968,7 +1064,7 @@ def fetch_database_properties( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "fetch_database_properties" not in self._stubs: - self._stubs["fetch_database_properties"] = self.grpc_channel.unary_unary( + self._stubs["fetch_database_properties"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/FetchDatabaseProperties", request_serializer=environments.FetchDatabasePropertiesRequest.serialize, response_deserializer=environments.FetchDatabasePropertiesResponse.deserialize, @@ -976,7 +1072,7 @@ def fetch_database_properties( return self._stubs["fetch_database_properties"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -988,7 +1084,7 @@ def delete_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + self._stubs["delete_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/DeleteOperation", request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, response_deserializer=None, @@ -1005,7 +1101,7 @@ def get_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( + self._stubs["get_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/GetOperation", request_serializer=operations_pb2.GetOperationRequest.SerializeToString, response_deserializer=operations_pb2.Operation.FromString, @@ -1024,7 +1120,7 @@ def list_operations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( + self._stubs["list_operations"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/ListOperations", request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, response_deserializer=operations_pb2.ListOperationsResponse.FromString, diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/grpc_asyncio.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/grpc_asyncio.py index 30621be46b85..ea3e6aecea44 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/grpc_asyncio.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import logging as std_logging +import pickle from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union import warnings @@ -24,14 +27,93 @@ from google.auth.transport.grpc import SslCredentials # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore from grpc.experimental import aio # type: ignore +import proto # type: ignore from google.cloud.orchestration.airflow.service_v1.types import environments from .base import DEFAULT_CLIENT_INFO, EnvironmentsTransport from .grpc import EnvironmentsGrpcTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientAIOInterceptor( + grpc.aio.UnaryUnaryClientInterceptor +): # pragma: NO COVER + async def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": str(client_call_details.method), + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + response = await continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = await response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = ( + dict([(k, str(v)) for k, v in response_metadata]) + if response_metadata + else None + ) + result = await response + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response to rpc {client_call_details.method}.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class EnvironmentsGrpcAsyncIOTransport(EnvironmentsTransport): """gRPC AsyncIO backend transport for Environments. @@ -229,10 +311,13 @@ def __init__( ], ) - # Wrap messages. This must be done after self._grpc_channel exists + self._interceptor = _LoggingClientAIOInterceptor() + self._grpc_channel._unary_unary_interceptors.append(self._interceptor) + self._logged_channel = self._grpc_channel self._wrap_with_kind = ( "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters ) + # Wrap messages. This must be done after self._logged_channel exists self._prep_wrapped_messages(client_info) @property @@ -255,7 +340,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel + self._logged_channel ) # Return the client from cache. @@ -282,7 +367,7 @@ def create_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_environment" not in self._stubs: - self._stubs["create_environment"] = self.grpc_channel.unary_unary( + self._stubs["create_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/CreateEnvironment", request_serializer=environments.CreateEnvironmentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -310,7 +395,7 @@ def get_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_environment" not in self._stubs: - self._stubs["get_environment"] = self.grpc_channel.unary_unary( + self._stubs["get_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/GetEnvironment", request_serializer=environments.GetEnvironmentRequest.serialize, response_deserializer=environments.Environment.deserialize, @@ -339,7 +424,7 @@ def list_environments( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_environments" not in self._stubs: - self._stubs["list_environments"] = self.grpc_channel.unary_unary( + self._stubs["list_environments"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/ListEnvironments", request_serializer=environments.ListEnvironmentsRequest.serialize, response_deserializer=environments.ListEnvironmentsResponse.deserialize, @@ -367,7 +452,7 @@ def update_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_environment" not in self._stubs: - self._stubs["update_environment"] = self.grpc_channel.unary_unary( + self._stubs["update_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/UpdateEnvironment", request_serializer=environments.UpdateEnvironmentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -395,7 +480,7 @@ def delete_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_environment" not in self._stubs: - self._stubs["delete_environment"] = self.grpc_channel.unary_unary( + self._stubs["delete_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/DeleteEnvironment", request_serializer=environments.DeleteEnvironmentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -424,7 +509,7 @@ def execute_airflow_command( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "execute_airflow_command" not in self._stubs: - self._stubs["execute_airflow_command"] = self.grpc_channel.unary_unary( + self._stubs["execute_airflow_command"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/ExecuteAirflowCommand", request_serializer=environments.ExecuteAirflowCommandRequest.serialize, response_deserializer=environments.ExecuteAirflowCommandResponse.deserialize, @@ -453,7 +538,7 @@ def stop_airflow_command( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stop_airflow_command" not in self._stubs: - self._stubs["stop_airflow_command"] = self.grpc_channel.unary_unary( + self._stubs["stop_airflow_command"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/StopAirflowCommand", request_serializer=environments.StopAirflowCommandRequest.serialize, response_deserializer=environments.StopAirflowCommandResponse.deserialize, @@ -482,7 +567,7 @@ def poll_airflow_command( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "poll_airflow_command" not in self._stubs: - self._stubs["poll_airflow_command"] = self.grpc_channel.unary_unary( + self._stubs["poll_airflow_command"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/PollAirflowCommand", request_serializer=environments.PollAirflowCommandRequest.serialize, response_deserializer=environments.PollAirflowCommandResponse.deserialize, @@ -515,7 +600,7 @@ def list_workloads( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_workloads" not in self._stubs: - self._stubs["list_workloads"] = self.grpc_channel.unary_unary( + self._stubs["list_workloads"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/ListWorkloads", request_serializer=environments.ListWorkloadsRequest.serialize, response_deserializer=environments.ListWorkloadsResponse.deserialize, @@ -546,7 +631,7 @@ def check_upgrade( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "check_upgrade" not in self._stubs: - self._stubs["check_upgrade"] = self.grpc_channel.unary_unary( + self._stubs["check_upgrade"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/CheckUpgrade", request_serializer=environments.CheckUpgradeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -578,7 +663,9 @@ def create_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_user_workloads_secret" not in self._stubs: - self._stubs["create_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_user_workloads_secret" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/CreateUserWorkloadsSecret", request_serializer=environments.CreateUserWorkloadsSecretRequest.serialize, response_deserializer=environments.UserWorkloadsSecret.deserialize, @@ -611,7 +698,7 @@ def get_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_user_workloads_secret" not in self._stubs: - self._stubs["get_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs["get_user_workloads_secret"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/GetUserWorkloadsSecret", request_serializer=environments.GetUserWorkloadsSecretRequest.serialize, response_deserializer=environments.UserWorkloadsSecret.deserialize, @@ -643,7 +730,9 @@ def list_user_workloads_secrets( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_user_workloads_secrets" not in self._stubs: - self._stubs["list_user_workloads_secrets"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_user_workloads_secrets" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/ListUserWorkloadsSecrets", request_serializer=environments.ListUserWorkloadsSecretsRequest.serialize, response_deserializer=environments.ListUserWorkloadsSecretsResponse.deserialize, @@ -675,7 +764,9 @@ def update_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_user_workloads_secret" not in self._stubs: - self._stubs["update_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_user_workloads_secret" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/UpdateUserWorkloadsSecret", request_serializer=environments.UpdateUserWorkloadsSecretRequest.serialize, response_deserializer=environments.UserWorkloadsSecret.deserialize, @@ -706,7 +797,9 @@ def delete_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_user_workloads_secret" not in self._stubs: - self._stubs["delete_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_user_workloads_secret" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/DeleteUserWorkloadsSecret", request_serializer=environments.DeleteUserWorkloadsSecretRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -741,7 +834,7 @@ def create_user_workloads_config_map( if "create_user_workloads_config_map" not in self._stubs: self._stubs[ "create_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/CreateUserWorkloadsConfigMap", request_serializer=environments.CreateUserWorkloadsConfigMapRequest.serialize, response_deserializer=environments.UserWorkloadsConfigMap.deserialize, @@ -775,7 +868,7 @@ def get_user_workloads_config_map( if "get_user_workloads_config_map" not in self._stubs: self._stubs[ "get_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/GetUserWorkloadsConfigMap", request_serializer=environments.GetUserWorkloadsConfigMapRequest.serialize, response_deserializer=environments.UserWorkloadsConfigMap.deserialize, @@ -810,7 +903,7 @@ def list_user_workloads_config_maps( if "list_user_workloads_config_maps" not in self._stubs: self._stubs[ "list_user_workloads_config_maps" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/ListUserWorkloadsConfigMaps", request_serializer=environments.ListUserWorkloadsConfigMapsRequest.serialize, response_deserializer=environments.ListUserWorkloadsConfigMapsResponse.deserialize, @@ -845,7 +938,7 @@ def update_user_workloads_config_map( if "update_user_workloads_config_map" not in self._stubs: self._stubs[ "update_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/UpdateUserWorkloadsConfigMap", request_serializer=environments.UpdateUserWorkloadsConfigMapRequest.serialize, response_deserializer=environments.UserWorkloadsConfigMap.deserialize, @@ -879,7 +972,7 @@ def delete_user_workloads_config_map( if "delete_user_workloads_config_map" not in self._stubs: self._stubs[ "delete_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/DeleteUserWorkloadsConfigMap", request_serializer=environments.DeleteUserWorkloadsConfigMapRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -911,7 +1004,7 @@ def save_snapshot( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "save_snapshot" not in self._stubs: - self._stubs["save_snapshot"] = self.grpc_channel.unary_unary( + self._stubs["save_snapshot"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/SaveSnapshot", request_serializer=environments.SaveSnapshotRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -943,7 +1036,7 @@ def load_snapshot( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "load_snapshot" not in self._stubs: - self._stubs["load_snapshot"] = self.grpc_channel.unary_unary( + self._stubs["load_snapshot"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/LoadSnapshot", request_serializer=environments.LoadSnapshotRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -972,7 +1065,7 @@ def database_failover( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "database_failover" not in self._stubs: - self._stubs["database_failover"] = self.grpc_channel.unary_unary( + self._stubs["database_failover"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/DatabaseFailover", request_serializer=environments.DatabaseFailoverRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1001,7 +1094,7 @@ def fetch_database_properties( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "fetch_database_properties" not in self._stubs: - self._stubs["fetch_database_properties"] = self.grpc_channel.unary_unary( + self._stubs["fetch_database_properties"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.Environments/FetchDatabaseProperties", request_serializer=environments.FetchDatabasePropertiesRequest.serialize, response_deserializer=environments.FetchDatabasePropertiesResponse.deserialize, @@ -1154,7 +1247,7 @@ def _wrap_method(self, func, *args, **kwargs): return gapic_v1.method_async.wrap_method(func, *args, **kwargs) def close(self): - return self.grpc_channel.close() + return self._logged_channel.close() @property def kind(self) -> str: @@ -1170,7 +1263,7 @@ def delete_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + self._stubs["delete_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/DeleteOperation", request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, response_deserializer=None, @@ -1187,7 +1280,7 @@ def get_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( + self._stubs["get_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/GetOperation", request_serializer=operations_pb2.GetOperationRequest.SerializeToString, response_deserializer=operations_pb2.Operation.FromString, @@ -1206,7 +1299,7 @@ def list_operations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( + self._stubs["list_operations"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/ListOperations", request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, response_deserializer=operations_pb2.ListOperationsResponse.FromString, diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/rest.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/rest.py index 82bb571a9026..7f897657f5d1 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/rest.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/rest.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import dataclasses import json # type: ignore +import logging from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings @@ -39,6 +39,14 @@ except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = logging.getLogger(__name__) DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, @@ -255,8 +263,10 @@ def post_update_user_workloads_secret(self, response): def pre_check_upgrade( self, request: environments.CheckUpgradeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.CheckUpgradeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.CheckUpgradeRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for check_upgrade Override in a subclass to manipulate the request or metadata @@ -278,8 +288,10 @@ def post_check_upgrade( def pre_create_environment( self, request: environments.CreateEnvironmentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.CreateEnvironmentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.CreateEnvironmentRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_environment Override in a subclass to manipulate the request or metadata @@ -301,9 +313,10 @@ def post_create_environment( def pre_create_user_workloads_config_map( self, request: environments.CreateUserWorkloadsConfigMapRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.CreateUserWorkloadsConfigMapRequest, Sequence[Tuple[str, str]] + environments.CreateUserWorkloadsConfigMapRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_user_workloads_config_map @@ -326,9 +339,10 @@ def post_create_user_workloads_config_map( def pre_create_user_workloads_secret( self, request: environments.CreateUserWorkloadsSecretRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.CreateUserWorkloadsSecretRequest, Sequence[Tuple[str, str]] + environments.CreateUserWorkloadsSecretRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_user_workloads_secret @@ -351,8 +365,10 @@ def post_create_user_workloads_secret( def pre_database_failover( self, request: environments.DatabaseFailoverRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.DatabaseFailoverRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.DatabaseFailoverRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for database_failover Override in a subclass to manipulate the request or metadata @@ -374,8 +390,10 @@ def post_database_failover( def pre_delete_environment( self, request: environments.DeleteEnvironmentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.DeleteEnvironmentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.DeleteEnvironmentRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_environment Override in a subclass to manipulate the request or metadata @@ -397,9 +415,10 @@ def post_delete_environment( def pre_delete_user_workloads_config_map( self, request: environments.DeleteUserWorkloadsConfigMapRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.DeleteUserWorkloadsConfigMapRequest, Sequence[Tuple[str, str]] + environments.DeleteUserWorkloadsConfigMapRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_user_workloads_config_map @@ -411,9 +430,10 @@ def pre_delete_user_workloads_config_map( def pre_delete_user_workloads_secret( self, request: environments.DeleteUserWorkloadsSecretRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.DeleteUserWorkloadsSecretRequest, Sequence[Tuple[str, str]] + environments.DeleteUserWorkloadsSecretRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_user_workloads_secret @@ -425,8 +445,11 @@ def pre_delete_user_workloads_secret( def pre_execute_airflow_command( self, request: environments.ExecuteAirflowCommandRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.ExecuteAirflowCommandRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.ExecuteAirflowCommandRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for execute_airflow_command Override in a subclass to manipulate the request or metadata @@ -448,8 +471,11 @@ def post_execute_airflow_command( def pre_fetch_database_properties( self, request: environments.FetchDatabasePropertiesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.FetchDatabasePropertiesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.FetchDatabasePropertiesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for fetch_database_properties Override in a subclass to manipulate the request or metadata @@ -471,8 +497,10 @@ def post_fetch_database_properties( def pre_get_environment( self, request: environments.GetEnvironmentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.GetEnvironmentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.GetEnvironmentRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_environment Override in a subclass to manipulate the request or metadata @@ -494,9 +522,10 @@ def post_get_environment( def pre_get_user_workloads_config_map( self, request: environments.GetUserWorkloadsConfigMapRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.GetUserWorkloadsConfigMapRequest, Sequence[Tuple[str, str]] + environments.GetUserWorkloadsConfigMapRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_user_workloads_config_map @@ -519,8 +548,11 @@ def post_get_user_workloads_config_map( def pre_get_user_workloads_secret( self, request: environments.GetUserWorkloadsSecretRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.GetUserWorkloadsSecretRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.GetUserWorkloadsSecretRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_user_workloads_secret Override in a subclass to manipulate the request or metadata @@ -542,8 +574,10 @@ def post_get_user_workloads_secret( def pre_list_environments( self, request: environments.ListEnvironmentsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.ListEnvironmentsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.ListEnvironmentsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_environments Override in a subclass to manipulate the request or metadata @@ -565,9 +599,10 @@ def post_list_environments( def pre_list_user_workloads_config_maps( self, request: environments.ListUserWorkloadsConfigMapsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.ListUserWorkloadsConfigMapsRequest, Sequence[Tuple[str, str]] + environments.ListUserWorkloadsConfigMapsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_user_workloads_config_maps @@ -590,8 +625,11 @@ def post_list_user_workloads_config_maps( def pre_list_user_workloads_secrets( self, request: environments.ListUserWorkloadsSecretsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.ListUserWorkloadsSecretsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.ListUserWorkloadsSecretsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_user_workloads_secrets Override in a subclass to manipulate the request or metadata @@ -613,8 +651,10 @@ def post_list_user_workloads_secrets( def pre_list_workloads( self, request: environments.ListWorkloadsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.ListWorkloadsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.ListWorkloadsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_workloads Override in a subclass to manipulate the request or metadata @@ -636,8 +676,10 @@ def post_list_workloads( def pre_load_snapshot( self, request: environments.LoadSnapshotRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.LoadSnapshotRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.LoadSnapshotRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for load_snapshot Override in a subclass to manipulate the request or metadata @@ -659,8 +701,10 @@ def post_load_snapshot( def pre_poll_airflow_command( self, request: environments.PollAirflowCommandRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.PollAirflowCommandRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.PollAirflowCommandRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for poll_airflow_command Override in a subclass to manipulate the request or metadata @@ -682,8 +726,10 @@ def post_poll_airflow_command( def pre_save_snapshot( self, request: environments.SaveSnapshotRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.SaveSnapshotRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.SaveSnapshotRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for save_snapshot Override in a subclass to manipulate the request or metadata @@ -705,8 +751,10 @@ def post_save_snapshot( def pre_stop_airflow_command( self, request: environments.StopAirflowCommandRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.StopAirflowCommandRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.StopAirflowCommandRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for stop_airflow_command Override in a subclass to manipulate the request or metadata @@ -728,8 +776,10 @@ def post_stop_airflow_command( def pre_update_environment( self, request: environments.UpdateEnvironmentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.UpdateEnvironmentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.UpdateEnvironmentRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_environment Override in a subclass to manipulate the request or metadata @@ -751,9 +801,10 @@ def post_update_environment( def pre_update_user_workloads_config_map( self, request: environments.UpdateUserWorkloadsConfigMapRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.UpdateUserWorkloadsConfigMapRequest, Sequence[Tuple[str, str]] + environments.UpdateUserWorkloadsConfigMapRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_user_workloads_config_map @@ -776,9 +827,10 @@ def post_update_user_workloads_config_map( def pre_update_user_workloads_secret( self, request: environments.UpdateUserWorkloadsSecretRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.UpdateUserWorkloadsSecretRequest, Sequence[Tuple[str, str]] + environments.UpdateUserWorkloadsSecretRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_user_workloads_secret @@ -801,8 +853,10 @@ def post_update_user_workloads_secret( def pre_delete_operation( self, request: operations_pb2.DeleteOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_operation Override in a subclass to manipulate the request or metadata @@ -822,8 +876,10 @@ def post_delete_operation(self, response: None) -> None: def pre_get_operation( self, request: operations_pb2.GetOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.GetOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_operation Override in a subclass to manipulate the request or metadata @@ -845,8 +901,10 @@ def post_get_operation( def pre_list_operations( self, request: operations_pb2.ListOperationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.ListOperationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_operations Override in a subclass to manipulate the request or metadata @@ -1034,7 +1092,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the check upgrade method over HTTP. @@ -1045,8 +1103,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -1059,6 +1119,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseCheckUpgrade._get_http_options() ) + request, metadata = self._interceptor.pre_check_upgrade(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseCheckUpgrade._get_transcoded_request( http_options, request @@ -1077,6 +1138,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.CheckUpgrade", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "CheckUpgrade", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._CheckUpgrade._get_response( self._host, @@ -1096,7 +1184,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_check_upgrade(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.check_upgrade", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "CheckUpgrade", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateEnvironment( @@ -1134,7 +1244,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the create environment method over HTTP. @@ -1144,8 +1254,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -1158,6 +1270,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseCreateEnvironment._get_http_options() ) + request, metadata = self._interceptor.pre_create_environment( request, metadata ) @@ -1174,6 +1287,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.CreateEnvironment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "CreateEnvironment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._CreateEnvironment._get_response( self._host, @@ -1193,7 +1333,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_environment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.create_environment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "CreateEnvironment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateUserWorkloadsConfigMap( @@ -1232,7 +1394,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Call the create user workloads config map method over HTTP. @@ -1244,8 +1406,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.UserWorkloadsConfigMap: @@ -1258,6 +1422,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseCreateUserWorkloadsConfigMap._get_http_options() ) + request, metadata = self._interceptor.pre_create_user_workloads_config_map( request, metadata ) @@ -1274,6 +1439,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.CreateUserWorkloadsConfigMap", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "CreateUserWorkloadsConfigMap", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._CreateUserWorkloadsConfigMap._get_response( @@ -1297,7 +1489,31 @@ def __call__( pb_resp = environments.UserWorkloadsConfigMap.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_user_workloads_config_map(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.UserWorkloadsConfigMap.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.create_user_workloads_config_map", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "CreateUserWorkloadsConfigMap", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateUserWorkloadsSecret( @@ -1336,7 +1552,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Call the create user workloads secret method over HTTP. @@ -1347,8 +1563,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.UserWorkloadsSecret: @@ -1361,6 +1579,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseCreateUserWorkloadsSecret._get_http_options() ) + request, metadata = self._interceptor.pre_create_user_workloads_secret( request, metadata ) @@ -1377,6 +1596,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.CreateUserWorkloadsSecret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "CreateUserWorkloadsSecret", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._CreateUserWorkloadsSecret._get_response( @@ -1400,7 +1646,31 @@ def __call__( pb_resp = environments.UserWorkloadsSecret.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_user_workloads_secret(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.UserWorkloadsSecret.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.create_user_workloads_secret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "CreateUserWorkloadsSecret", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DatabaseFailover( @@ -1438,7 +1708,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the database failover method over HTTP. @@ -1450,8 +1720,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -1464,6 +1736,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseDatabaseFailover._get_http_options() ) + request, metadata = self._interceptor.pre_database_failover( request, metadata ) @@ -1480,6 +1753,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.DatabaseFailover", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "DatabaseFailover", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._DatabaseFailover._get_response( self._host, @@ -1499,7 +1799,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_database_failover(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.database_failover", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "DatabaseFailover", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteEnvironment( @@ -1536,7 +1858,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the delete environment method over HTTP. @@ -1546,8 +1868,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -1560,6 +1884,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseDeleteEnvironment._get_http_options() ) + request, metadata = self._interceptor.pre_delete_environment( request, metadata ) @@ -1572,6 +1897,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.DeleteEnvironment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "DeleteEnvironment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._DeleteEnvironment._get_response( self._host, @@ -1590,7 +1942,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_delete_environment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.delete_environment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "DeleteEnvironment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteUserWorkloadsConfigMap( @@ -1628,7 +2002,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ): r"""Call the delete user workloads config map method over HTTP. @@ -1640,13 +2014,16 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ http_options = ( _BaseEnvironmentsRestTransport._BaseDeleteUserWorkloadsConfigMap._get_http_options() ) + request, metadata = self._interceptor.pre_delete_user_workloads_config_map( request, metadata ) @@ -1659,6 +2036,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.DeleteUserWorkloadsConfigMap", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "DeleteUserWorkloadsConfigMap", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._DeleteUserWorkloadsConfigMap._get_response( @@ -1711,7 +2115,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ): r"""Call the delete user workloads secret method over HTTP. @@ -1722,13 +2126,16 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ http_options = ( _BaseEnvironmentsRestTransport._BaseDeleteUserWorkloadsSecret._get_http_options() ) + request, metadata = self._interceptor.pre_delete_user_workloads_secret( request, metadata ) @@ -1741,6 +2148,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.DeleteUserWorkloadsSecret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "DeleteUserWorkloadsSecret", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._DeleteUserWorkloadsSecret._get_response( @@ -1793,7 +2227,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ExecuteAirflowCommandResponse: r"""Call the execute airflow command method over HTTP. @@ -1803,8 +2237,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.ExecuteAirflowCommandResponse: @@ -1816,6 +2252,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseExecuteAirflowCommand._get_http_options() ) + request, metadata = self._interceptor.pre_execute_airflow_command( request, metadata ) @@ -1832,6 +2269,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.ExecuteAirflowCommand", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "ExecuteAirflowCommand", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._ExecuteAirflowCommand._get_response( self._host, @@ -1853,7 +2317,31 @@ def __call__( pb_resp = environments.ExecuteAirflowCommandResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_execute_airflow_command(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + environments.ExecuteAirflowCommandResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.execute_airflow_command", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "ExecuteAirflowCommand", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _FetchDatabaseProperties( @@ -1891,7 +2379,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.FetchDatabasePropertiesResponse: r"""Call the fetch database properties method over HTTP. @@ -1902,8 +2390,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.FetchDatabasePropertiesResponse: @@ -1915,6 +2405,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseFetchDatabaseProperties._get_http_options() ) + request, metadata = self._interceptor.pre_fetch_database_properties( request, metadata ) @@ -1927,6 +2418,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.FetchDatabaseProperties", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "FetchDatabaseProperties", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._FetchDatabaseProperties._get_response( self._host, @@ -1947,7 +2465,31 @@ def __call__( pb_resp = environments.FetchDatabasePropertiesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_fetch_database_properties(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + environments.FetchDatabasePropertiesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.fetch_database_properties", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "FetchDatabaseProperties", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetEnvironment( @@ -1984,7 +2526,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.Environment: r"""Call the get environment method over HTTP. @@ -1994,8 +2536,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.Environment: @@ -2007,6 +2551,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseGetEnvironment._get_http_options() ) + request, metadata = self._interceptor.pre_get_environment(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseGetEnvironment._get_transcoded_request( http_options, request @@ -2017,6 +2562,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.GetEnvironment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "GetEnvironment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._GetEnvironment._get_response( self._host, @@ -2037,7 +2609,29 @@ def __call__( pb_resp = environments.Environment.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_environment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.Environment.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.get_environment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "GetEnvironment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetUserWorkloadsConfigMap( @@ -2075,7 +2669,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Call the get user workloads config map method over HTTP. @@ -2086,8 +2680,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.UserWorkloadsConfigMap: @@ -2100,6 +2696,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseGetUserWorkloadsConfigMap._get_http_options() ) + request, metadata = self._interceptor.pre_get_user_workloads_config_map( request, metadata ) @@ -2112,6 +2709,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.GetUserWorkloadsConfigMap", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "GetUserWorkloadsConfigMap", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._GetUserWorkloadsConfigMap._get_response( @@ -2134,7 +2758,31 @@ def __call__( pb_resp = environments.UserWorkloadsConfigMap.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_user_workloads_config_map(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.UserWorkloadsConfigMap.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.get_user_workloads_config_map", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "GetUserWorkloadsConfigMap", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetUserWorkloadsSecret( @@ -2171,7 +2819,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Call the get user workloads secret method over HTTP. @@ -2181,8 +2829,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.UserWorkloadsSecret: @@ -2195,6 +2845,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseGetUserWorkloadsSecret._get_http_options() ) + request, metadata = self._interceptor.pre_get_user_workloads_secret( request, metadata ) @@ -2207,6 +2858,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.GetUserWorkloadsSecret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "GetUserWorkloadsSecret", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._GetUserWorkloadsSecret._get_response( self._host, @@ -2227,7 +2905,31 @@ def __call__( pb_resp = environments.UserWorkloadsSecret.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_user_workloads_secret(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.UserWorkloadsSecret.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.get_user_workloads_secret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "GetUserWorkloadsSecret", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListEnvironments( @@ -2264,7 +2966,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ListEnvironmentsResponse: r"""Call the list environments method over HTTP. @@ -2275,8 +2977,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.ListEnvironmentsResponse: @@ -2288,6 +2992,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseListEnvironments._get_http_options() ) + request, metadata = self._interceptor.pre_list_environments( request, metadata ) @@ -2300,6 +3005,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.ListEnvironments", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "ListEnvironments", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._ListEnvironments._get_response( self._host, @@ -2320,7 +3052,31 @@ def __call__( pb_resp = environments.ListEnvironmentsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_environments(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.ListEnvironmentsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.list_environments", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "ListEnvironments", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListUserWorkloadsConfigMaps( @@ -2358,7 +3114,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ListUserWorkloadsConfigMapsResponse: r"""Call the list user workloads config maps method over HTTP. @@ -2370,8 +3126,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.ListUserWorkloadsConfigMapsResponse: @@ -2383,6 +3141,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseListUserWorkloadsConfigMaps._get_http_options() ) + request, metadata = self._interceptor.pre_list_user_workloads_config_maps( request, metadata ) @@ -2395,6 +3154,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.ListUserWorkloadsConfigMaps", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "ListUserWorkloadsConfigMaps", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._ListUserWorkloadsConfigMaps._get_response( @@ -2417,7 +3203,33 @@ def __call__( pb_resp = environments.ListUserWorkloadsConfigMapsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_user_workloads_config_maps(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + environments.ListUserWorkloadsConfigMapsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.list_user_workloads_config_maps", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "ListUserWorkloadsConfigMaps", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListUserWorkloadsSecrets( @@ -2455,7 +3267,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ListUserWorkloadsSecretsResponse: r"""Call the list user workloads secrets method over HTTP. @@ -2466,8 +3278,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.ListUserWorkloadsSecretsResponse: @@ -2479,6 +3293,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseListUserWorkloadsSecrets._get_http_options() ) + request, metadata = self._interceptor.pre_list_user_workloads_secrets( request, metadata ) @@ -2491,6 +3306,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.ListUserWorkloadsSecrets", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "ListUserWorkloadsSecrets", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._ListUserWorkloadsSecrets._get_response( @@ -2513,7 +3355,31 @@ def __call__( pb_resp = environments.ListUserWorkloadsSecretsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_user_workloads_secrets(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + environments.ListUserWorkloadsSecretsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.list_user_workloads_secrets", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "ListUserWorkloadsSecrets", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListWorkloads( @@ -2550,7 +3416,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ListWorkloadsResponse: r"""Call the list workloads method over HTTP. @@ -2561,8 +3427,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.ListWorkloadsResponse: @@ -2572,6 +3440,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseListWorkloads._get_http_options() ) + request, metadata = self._interceptor.pre_list_workloads(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseListWorkloads._get_transcoded_request( http_options, request @@ -2582,6 +3451,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.ListWorkloads", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "ListWorkloads", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._ListWorkloads._get_response( self._host, @@ -2602,7 +3498,31 @@ def __call__( pb_resp = environments.ListWorkloadsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_workloads(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.ListWorkloadsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.list_workloads", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "ListWorkloads", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _LoadSnapshot( @@ -2640,7 +3560,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the load snapshot method over HTTP. @@ -2651,8 +3571,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -2665,6 +3587,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseLoadSnapshot._get_http_options() ) + request, metadata = self._interceptor.pre_load_snapshot(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseLoadSnapshot._get_transcoded_request( http_options, request @@ -2683,6 +3606,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.LoadSnapshot", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "LoadSnapshot", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._LoadSnapshot._get_response( self._host, @@ -2702,7 +3652,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_load_snapshot(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.load_snapshot", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "LoadSnapshot", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _PollAirflowCommand( @@ -2740,7 +3712,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.PollAirflowCommandResponse: r"""Call the poll airflow command method over HTTP. @@ -2750,8 +3722,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.PollAirflowCommandResponse: @@ -2763,6 +3737,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BasePollAirflowCommand._get_http_options() ) + request, metadata = self._interceptor.pre_poll_airflow_command( request, metadata ) @@ -2779,6 +3754,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.PollAirflowCommand", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "PollAirflowCommand", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._PollAirflowCommand._get_response( self._host, @@ -2800,7 +3802,31 @@ def __call__( pb_resp = environments.PollAirflowCommandResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_poll_airflow_command(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.PollAirflowCommandResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.poll_airflow_command", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "PollAirflowCommand", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SaveSnapshot( @@ -2838,7 +3864,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the save snapshot method over HTTP. @@ -2849,8 +3875,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -2863,6 +3891,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseSaveSnapshot._get_http_options() ) + request, metadata = self._interceptor.pre_save_snapshot(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseSaveSnapshot._get_transcoded_request( http_options, request @@ -2881,6 +3910,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.SaveSnapshot", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "SaveSnapshot", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._SaveSnapshot._get_response( self._host, @@ -2900,7 +3956,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_save_snapshot(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.save_snapshot", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "SaveSnapshot", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _StopAirflowCommand( @@ -2938,7 +4016,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.StopAirflowCommandResponse: r"""Call the stop airflow command method over HTTP. @@ -2948,8 +4026,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.StopAirflowCommandResponse: @@ -2961,6 +4041,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseStopAirflowCommand._get_http_options() ) + request, metadata = self._interceptor.pre_stop_airflow_command( request, metadata ) @@ -2977,6 +4058,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.StopAirflowCommand", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "StopAirflowCommand", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._StopAirflowCommand._get_response( self._host, @@ -2998,7 +4106,31 @@ def __call__( pb_resp = environments.StopAirflowCommandResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_stop_airflow_command(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.StopAirflowCommandResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.stop_airflow_command", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "StopAirflowCommand", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateEnvironment( @@ -3036,7 +4168,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the update environment method over HTTP. @@ -3046,8 +4178,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -3060,6 +4194,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseUpdateEnvironment._get_http_options() ) + request, metadata = self._interceptor.pre_update_environment( request, metadata ) @@ -3076,6 +4211,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.UpdateEnvironment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "UpdateEnvironment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._UpdateEnvironment._get_response( self._host, @@ -3095,7 +4257,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_environment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.update_environment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "UpdateEnvironment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateUserWorkloadsConfigMap( @@ -3134,7 +4318,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Call the update user workloads config map method over HTTP. @@ -3146,8 +4330,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.UserWorkloadsConfigMap: @@ -3160,6 +4346,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseUpdateUserWorkloadsConfigMap._get_http_options() ) + request, metadata = self._interceptor.pre_update_user_workloads_config_map( request, metadata ) @@ -3176,6 +4363,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.UpdateUserWorkloadsConfigMap", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "UpdateUserWorkloadsConfigMap", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._UpdateUserWorkloadsConfigMap._get_response( @@ -3199,7 +4413,31 @@ def __call__( pb_resp = environments.UserWorkloadsConfigMap.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_user_workloads_config_map(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.UserWorkloadsConfigMap.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.update_user_workloads_config_map", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "UpdateUserWorkloadsConfigMap", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateUserWorkloadsSecret( @@ -3238,7 +4476,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Call the update user workloads secret method over HTTP. @@ -3249,8 +4487,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.UserWorkloadsSecret: @@ -3263,6 +4503,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseUpdateUserWorkloadsSecret._get_http_options() ) + request, metadata = self._interceptor.pre_update_user_workloads_secret( request, metadata ) @@ -3279,6 +4520,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.UpdateUserWorkloadsSecret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "UpdateUserWorkloadsSecret", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._UpdateUserWorkloadsSecret._get_response( @@ -3302,7 +4570,31 @@ def __call__( pb_resp = environments.UserWorkloadsSecret.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_user_workloads_secret(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.UserWorkloadsSecret.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.update_user_workloads_secret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "UpdateUserWorkloadsSecret", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3574,7 +4866,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Call the delete operation method over HTTP. @@ -3584,13 +4876,16 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ http_options = ( _BaseEnvironmentsRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3603,6 +4898,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._DeleteOperation._get_response( self._host, @@ -3658,7 +4980,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the get operation method over HTTP. @@ -3668,8 +4990,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: operations_pb2.Operation: Response from GetOperation method. @@ -3678,6 +5002,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3690,6 +5015,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.GetOperation", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._GetOperation._get_response( self._host, @@ -3709,6 +5061,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_operation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3749,7 +5122,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Call the list operations method over HTTP. @@ -3759,8 +5132,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: operations_pb2.ListOperationsResponse: Response from ListOperations method. @@ -3769,6 +5144,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3779,6 +5155,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.EnvironmentsClient.ListOperations", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._ListOperations._get_response( self._host, @@ -3798,6 +5201,27 @@ def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_operations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.EnvironmentsAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.Environments", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/async_client.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/async_client.py index 68682cb0ddbd..433e67bec8b2 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/async_client.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/async_client.py @@ -14,6 +14,7 @@ # limitations under the License. # from collections import OrderedDict +import logging as std_logging import re from typing import ( Callable, @@ -53,6 +54,15 @@ from .transports.base import DEFAULT_CLIENT_INFO, ImageVersionsTransport from .transports.grpc_asyncio import ImageVersionsGrpcAsyncIOTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + class ImageVersionsAsyncClient: """Readonly service to query available ImageVersions.""" @@ -256,6 +266,28 @@ def __init__( client_info=client_info, ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.cloud.orchestration.airflow.service_v1.ImageVersionsAsyncClient`.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "universeDomain": getattr( + self._client._transport._credentials, "universe_domain", "" + ), + "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", + "credentialsInfo": getattr( + self.transport._credentials, "get_cred_info", lambda: None + )(), + } + if hasattr(self._client._transport, "_credentials") + else { + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "credentialsType": None, + }, + ) + async def list_image_versions( self, request: Optional[Union[image_versions.ListImageVersionsRequest, dict]] = None, @@ -263,7 +295,7 @@ async def list_image_versions( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListImageVersionsAsyncPager: r"""List ImageVersions for provided location. @@ -308,8 +340,10 @@ async def sample_list_image_versions(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.services.image_versions.pagers.ListImageVersionsAsyncPager: @@ -383,7 +417,7 @@ async def list_operations( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -394,8 +428,10 @@ async def list_operations( retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.ListOperationsResponse: Response message for ``ListOperations`` method. @@ -436,7 +472,7 @@ async def get_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -447,8 +483,10 @@ async def get_operation( retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: An ``Operation`` object. @@ -489,7 +527,7 @@ async def delete_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a long-running operation. @@ -505,8 +543,10 @@ async def delete_operation( retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: None """ diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/client.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/client.py index 41117d5d931f..ef55915c32ca 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/client.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/client.py @@ -14,6 +14,7 @@ # limitations under the License. # from collections import OrderedDict +import logging as std_logging import os import re from typing import ( @@ -50,6 +51,15 @@ except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + from google.longrunning import operations_pb2 # type: ignore from google.cloud.orchestration.airflow.service_v1.services.image_versions import pagers @@ -558,6 +568,10 @@ def __init__( # Initialize the universe domain validation. self._is_universe_domain_valid = False + if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER + # Setup logging. + client_logging.initialize_logging() + api_key_value = getattr(self._client_options, "api_key", None) if api_key_value and credentials: raise ValueError( @@ -623,6 +637,29 @@ def __init__( api_audience=self._client_options.api_audience, ) + if "async" not in str(self._transport): + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.cloud.orchestration.airflow.service_v1.ImageVersionsClient`.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "universeDomain": getattr( + self._transport._credentials, "universe_domain", "" + ), + "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}", + "credentialsInfo": getattr( + self.transport._credentials, "get_cred_info", lambda: None + )(), + } + if hasattr(self._transport, "_credentials") + else { + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "credentialsType": None, + }, + ) + def list_image_versions( self, request: Optional[Union[image_versions.ListImageVersionsRequest, dict]] = None, @@ -630,7 +667,7 @@ def list_image_versions( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListImageVersionsPager: r"""List ImageVersions for provided location. @@ -675,8 +712,10 @@ def sample_list_image_versions(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1.services.image_versions.pagers.ListImageVersionsPager: @@ -760,7 +799,7 @@ def list_operations( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -771,8 +810,10 @@ def list_operations( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.ListOperationsResponse: Response message for ``ListOperations`` method. @@ -813,7 +854,7 @@ def get_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -824,8 +865,10 @@ def get_operation( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: An ``Operation`` object. @@ -866,7 +909,7 @@ def delete_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a long-running operation. @@ -882,8 +925,10 @@ def delete_operation( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: None """ diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/pagers.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/pagers.py index 4469614b1e77..70f81c9ab5f0 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/pagers.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/pagers.py @@ -67,7 +67,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -81,8 +81,10 @@ def __init__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = image_versions.ListImageVersionsRequest(request) @@ -141,7 +143,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -155,8 +157,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = image_versions.ListImageVersionsRequest(request) diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/grpc.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/grpc.py index f9256deebd89..a9a500e76075 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/grpc.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/grpc.py @@ -13,6 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import json +import logging as std_logging +import pickle from typing import Callable, Dict, Optional, Sequence, Tuple, Union import warnings @@ -21,12 +24,90 @@ from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.longrunning import operations_pb2 # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.orchestration.airflow.service_v1.types import image_versions from .base import DEFAULT_CLIENT_INFO, ImageVersionsTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER + def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "rpcName": client_call_details.method, + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + + response = continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = ( + dict([(k, str(v)) for k, v in response_metadata]) + if response_metadata + else None + ) + result = response.result() + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response for {client_call_details.method}.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ImageVersionsGrpcTransport(ImageVersionsTransport): """gRPC backend transport for ImageVersions. @@ -180,7 +261,12 @@ def __init__( ], ) - # Wrap messages. This must be done after self._grpc_channel exists + self._interceptor = _LoggingClientInterceptor() + self._logged_channel = grpc.intercept_channel( + self._grpc_channel, self._interceptor + ) + + # Wrap messages. This must be done after self._logged_channel exists self._prep_wrapped_messages(client_info) @classmethod @@ -257,7 +343,7 @@ def list_image_versions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_image_versions" not in self._stubs: - self._stubs["list_image_versions"] = self.grpc_channel.unary_unary( + self._stubs["list_image_versions"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.ImageVersions/ListImageVersions", request_serializer=image_versions.ListImageVersionsRequest.serialize, response_deserializer=image_versions.ListImageVersionsResponse.deserialize, @@ -265,7 +351,7 @@ def list_image_versions( return self._stubs["list_image_versions"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -277,7 +363,7 @@ def delete_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + self._stubs["delete_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/DeleteOperation", request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, response_deserializer=None, @@ -294,7 +380,7 @@ def get_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( + self._stubs["get_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/GetOperation", request_serializer=operations_pb2.GetOperationRequest.SerializeToString, response_deserializer=operations_pb2.Operation.FromString, @@ -313,7 +399,7 @@ def list_operations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( + self._stubs["list_operations"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/ListOperations", request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, response_deserializer=operations_pb2.ListOperationsResponse.FromString, diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/grpc_asyncio.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/grpc_asyncio.py index 345418453c51..998e93cfe47b 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/grpc_asyncio.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import logging as std_logging +import pickle from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union import warnings @@ -23,14 +26,93 @@ from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.longrunning import operations_pb2 # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore from grpc.experimental import aio # type: ignore +import proto # type: ignore from google.cloud.orchestration.airflow.service_v1.types import image_versions from .base import DEFAULT_CLIENT_INFO, ImageVersionsTransport from .grpc import ImageVersionsGrpcTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientAIOInterceptor( + grpc.aio.UnaryUnaryClientInterceptor +): # pragma: NO COVER + async def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "rpcName": str(client_call_details.method), + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + response = await continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = await response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = ( + dict([(k, str(v)) for k, v in response_metadata]) + if response_metadata + else None + ) + result = await response + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response to rpc {client_call_details.method}.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ImageVersionsGrpcAsyncIOTransport(ImageVersionsTransport): """gRPC AsyncIO backend transport for ImageVersions. @@ -227,10 +309,13 @@ def __init__( ], ) - # Wrap messages. This must be done after self._grpc_channel exists + self._interceptor = _LoggingClientAIOInterceptor() + self._grpc_channel._unary_unary_interceptors.append(self._interceptor) + self._logged_channel = self._grpc_channel self._wrap_with_kind = ( "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters ) + # Wrap messages. This must be done after self._logged_channel exists self._prep_wrapped_messages(client_info) @property @@ -265,7 +350,7 @@ def list_image_versions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_image_versions" not in self._stubs: - self._stubs["list_image_versions"] = self.grpc_channel.unary_unary( + self._stubs["list_image_versions"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1.ImageVersions/ListImageVersions", request_serializer=image_versions.ListImageVersionsRequest.serialize, response_deserializer=image_versions.ListImageVersionsResponse.deserialize, @@ -303,7 +388,7 @@ def _wrap_method(self, func, *args, **kwargs): return gapic_v1.method_async.wrap_method(func, *args, **kwargs) def close(self): - return self.grpc_channel.close() + return self._logged_channel.close() @property def kind(self) -> str: @@ -319,7 +404,7 @@ def delete_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + self._stubs["delete_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/DeleteOperation", request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, response_deserializer=None, @@ -336,7 +421,7 @@ def get_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( + self._stubs["get_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/GetOperation", request_serializer=operations_pb2.GetOperationRequest.SerializeToString, response_deserializer=operations_pb2.Operation.FromString, @@ -355,7 +440,7 @@ def list_operations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( + self._stubs["list_operations"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/ListOperations", request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, response_deserializer=operations_pb2.ListOperationsResponse.FromString, diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/rest.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/rest.py index 78d71205d29e..ce3180d59c9d 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/rest.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/rest.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import dataclasses import json # type: ignore +import logging from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings @@ -38,6 +38,14 @@ except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = logging.getLogger(__name__) DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, @@ -78,8 +86,10 @@ def post_list_image_versions(self, response): def pre_list_image_versions( self, request: image_versions.ListImageVersionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[image_versions.ListImageVersionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + image_versions.ListImageVersionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_image_versions Override in a subclass to manipulate the request or metadata @@ -101,8 +111,10 @@ def post_list_image_versions( def pre_delete_operation( self, request: operations_pb2.DeleteOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_operation Override in a subclass to manipulate the request or metadata @@ -122,8 +134,10 @@ def post_delete_operation(self, response: None) -> None: def pre_get_operation( self, request: operations_pb2.GetOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.GetOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_operation Override in a subclass to manipulate the request or metadata @@ -145,8 +159,10 @@ def post_get_operation( def pre_list_operations( self, request: operations_pb2.ListOperationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.ListOperationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_operations Override in a subclass to manipulate the request or metadata @@ -286,7 +302,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> image_versions.ListImageVersionsResponse: r"""Call the list image versions method over HTTP. @@ -297,8 +313,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.image_versions.ListImageVersionsResponse: @@ -310,6 +328,7 @@ def __call__( http_options = ( _BaseImageVersionsRestTransport._BaseListImageVersions._get_http_options() ) + request, metadata = self._interceptor.pre_list_image_versions( request, metadata ) @@ -322,6 +341,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.ImageVersionsClient.ListImageVersions", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "rpcName": "ListImageVersions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ImageVersionsRestTransport._ListImageVersions._get_response( self._host, @@ -342,7 +388,31 @@ def __call__( pb_resp = image_versions.ListImageVersionsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_image_versions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = image_versions.ListImageVersionsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.ImageVersionsClient.list_image_versions", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "rpcName": "ListImageVersions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -394,7 +464,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Call the delete operation method over HTTP. @@ -404,13 +474,16 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ http_options = ( _BaseImageVersionsRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -423,6 +496,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.ImageVersionsClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ImageVersionsRestTransport._DeleteOperation._get_response( self._host, @@ -478,7 +578,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the get operation method over HTTP. @@ -488,8 +588,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: operations_pb2.Operation: Response from GetOperation method. @@ -498,6 +600,7 @@ def __call__( http_options = ( _BaseImageVersionsRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseImageVersionsRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -508,6 +611,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.ImageVersionsClient.GetOperation", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ImageVersionsRestTransport._GetOperation._get_response( self._host, @@ -527,6 +657,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_operation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.ImageVersionsAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -567,7 +718,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Call the list operations method over HTTP. @@ -577,8 +728,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: operations_pb2.ListOperationsResponse: Response from ListOperations method. @@ -587,6 +740,7 @@ def __call__( http_options = ( _BaseImageVersionsRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseImageVersionsRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -597,6 +751,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1.ImageVersionsClient.ListOperations", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ImageVersionsRestTransport._ListOperations._get_response( self._host, @@ -616,6 +797,27 @@ def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_operations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1.ImageVersionsAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1.ImageVersions", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/types/environments.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/types/environments.py index 05f5049857da..911b3695da9f 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/types/environments.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/types/environments.py @@ -863,6 +863,13 @@ class UserWorkloadsSecret(proto.Message): token, or a key. The values for all keys have to be base64-encoded strings. For details see: https://kubernetes.io/docs/concepts/configuration/secret/ + + Example: + + { + "example": "ZXhhbXBsZV92YWx1ZQ==", + "another-example": + "YW5vdGhlcl9leGFtcGxlX3ZhbHVl" } """ name: str = proto.Field( @@ -915,11 +922,14 @@ class UserWorkloadsConfigMap(proto.Message): ConfigMap, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}". data (MutableMapping[str, str]): - Optional. The "data" field of Kubernetes - ConfigMap, organized in key-value pairs. For - details see: - + Optional. The "data" field of Kubernetes ConfigMap, + organized in key-value pairs. For details see: https://kubernetes.io/docs/concepts/configuration/configmap/ + + Example: + + { "example_key": "example_value", "another_key": + "another_value" } """ name: str = proto.Field( @@ -1352,14 +1362,14 @@ class EnvironmentConfig(proto.Message): This field is supported for Cloud Composer environments in versions composer-1.\ *.*-airflow-*.*.*. software_config (google.cloud.orchestration.airflow.service_v1.types.SoftwareConfig): - The configuration settings for software - inside the environment. + Optional. The configuration settings for + software inside the environment. node_config (google.cloud.orchestration.airflow.service_v1.types.NodeConfig): - The configuration used for the Kubernetes - Engine cluster. + Optional. The configuration used for the + Kubernetes Engine cluster. private_environment_config (google.cloud.orchestration.airflow.service_v1.types.PrivateEnvironmentConfig): - The configuration used for the Private IP - Cloud Composer environment. + Optional. The configuration used for the + Private IP Cloud Composer environment. web_server_network_access_control (google.cloud.orchestration.airflow.service_v1.types.WebServerNetworkAccessControl): Optional. The network-level access control policy for the Airflow web server. If @@ -1741,10 +1751,10 @@ class SoftwareConfig(proto.Message): Attributes: image_version (str): - The version of the software running in the environment. This - encapsulates both the version of Cloud Composer - functionality and the version of Apache Airflow. It must - match the regular expression + Optional. The version of the software running in the + environment. This encapsulates both the version of Cloud + Composer functionality and the version of Apache Airflow. It + must match the regular expression ``composer-([0-9]+(\.[0-9]+\.[0-9]+(-preview\.[0-9]+)?)?|latest)-airflow-([0-9]+(\.[0-9]+(\.[0-9]+)?)?)``. When used as input, the server also checks if the provided version is supported and denies the request for an @@ -2748,15 +2758,15 @@ class Environment(proto.Message): Attributes: name (str): - The resource name of the environment, in the - form: + Identifier. The resource name of the + environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}" EnvironmentId must start with a lowercase letter followed by up to 63 lowercase letters, numbers, or hyphens, and cannot end with a hyphen. config (google.cloud.orchestration.airflow.service_v1.types.EnvironmentConfig): - Configuration parameters for this + Optional. Configuration parameters for this environment. uuid (str): Output only. The UUID (Universally Unique diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/gapic_version.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/gapic_version.py index 2fd2bb1630b4..558c8aab67c5 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/gapic_version.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.15.1" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/async_client.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/async_client.py index 83f8123afa03..e05b2c33c7f9 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/async_client.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/async_client.py @@ -14,6 +14,7 @@ # limitations under the License. # from collections import OrderedDict +import logging as std_logging import re from typing import ( Callable, @@ -63,6 +64,15 @@ from .transports.base import DEFAULT_CLIENT_INFO, EnvironmentsTransport from .transports.grpc_asyncio import EnvironmentsGrpcAsyncIOTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + class EnvironmentsAsyncClient: """Managed Apache Airflow Environments.""" @@ -276,6 +286,28 @@ def __init__( client_info=client_info, ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsAsyncClient`.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "universeDomain": getattr( + self._client._transport._credentials, "universe_domain", "" + ), + "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", + "credentialsInfo": getattr( + self.transport._credentials, "get_cred_info", lambda: None + )(), + } + if hasattr(self._client._transport, "_credentials") + else { + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "credentialsType": None, + }, + ) + async def create_environment( self, request: Optional[Union[environments.CreateEnvironmentRequest, dict]] = None, @@ -284,7 +316,7 @@ async def create_environment( environment: Optional[environments.Environment] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Create a new environment. @@ -335,8 +367,10 @@ async def sample_create_environment(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -410,7 +444,7 @@ async def get_environment( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.Environment: r"""Get an existing environment. @@ -453,8 +487,10 @@ async def sample_get_environment(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.Environment: @@ -515,7 +551,7 @@ async def list_environments( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListEnvironmentsAsyncPager: r"""List environments. @@ -560,8 +596,10 @@ async def sample_list_environments(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListEnvironmentsAsyncPager: @@ -638,7 +676,7 @@ async def update_environment( update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Update an environment. @@ -913,8 +951,10 @@ async def sample_update_environment(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -990,7 +1030,7 @@ async def delete_environment( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Delete an environment. @@ -1037,8 +1077,10 @@ async def sample_delete_environment(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -1116,7 +1158,7 @@ async def restart_web_server( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Restart Airflow web server. @@ -1155,8 +1197,10 @@ async def sample_restart_web_server(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -1213,7 +1257,7 @@ async def check_upgrade( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Check if an upgrade operation on the environment will succeed. @@ -1256,8 +1300,10 @@ async def sample_check_upgrade(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -1317,7 +1363,7 @@ async def execute_airflow_command( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ExecuteAirflowCommandResponse: r"""Executes Airflow CLI command. @@ -1352,8 +1398,10 @@ async def sample_execute_airflow_command(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.ExecuteAirflowCommandResponse: @@ -1401,7 +1449,7 @@ async def stop_airflow_command( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.StopAirflowCommandResponse: r"""Stops Airflow CLI command execution. @@ -1436,8 +1484,10 @@ async def sample_stop_airflow_command(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.StopAirflowCommandResponse: @@ -1485,7 +1535,7 @@ async def poll_airflow_command( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.PollAirflowCommandResponse: r"""Polls Airflow CLI command execution and fetches logs. @@ -1520,8 +1570,10 @@ async def sample_poll_airflow_command(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.PollAirflowCommandResponse: @@ -1570,7 +1622,7 @@ async def list_workloads( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListWorkloadsAsyncPager: r"""Lists workloads in a Cloud Composer environment. Workload is a unit that runs a single Composer component. @@ -1620,8 +1672,10 @@ async def sample_list_workloads(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListWorkloadsAsyncPager: @@ -1699,7 +1753,7 @@ async def create_user_workloads_secret( user_workloads_secret: Optional[environments.UserWorkloadsSecret] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Creates a user workloads Secret. @@ -1753,8 +1807,10 @@ async def sample_create_user_workloads_secret(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsSecret: @@ -1820,7 +1876,7 @@ async def get_user_workloads_secret( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Gets an existing user workloads Secret. Values of the "data" field in the response are cleared. @@ -1868,8 +1924,10 @@ async def sample_get_user_workloads_secret(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsSecret: @@ -1933,7 +1991,7 @@ async def list_user_workloads_secrets( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListUserWorkloadsSecretsAsyncPager: r"""Lists user workloads Secrets. @@ -1981,8 +2039,10 @@ async def sample_list_user_workloads_secrets(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListUserWorkloadsSecretsAsyncPager: @@ -2059,7 +2119,7 @@ async def update_user_workloads_secret( user_workloads_secret: Optional[environments.UserWorkloadsSecret] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Updates a user workloads Secret. @@ -2104,8 +2164,10 @@ async def sample_update_user_workloads_secret(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsSecret: @@ -2171,7 +2233,7 @@ async def delete_user_workloads_secret( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a user workloads Secret. @@ -2215,8 +2277,10 @@ async def sample_delete_user_workloads_secret(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -2271,7 +2335,7 @@ async def create_user_workloads_config_map( user_workloads_config_map: Optional[environments.UserWorkloadsConfigMap] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Creates a user workloads ConfigMap. @@ -2326,8 +2390,10 @@ async def sample_create_user_workloads_config_map(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsConfigMap: @@ -2393,7 +2459,7 @@ async def get_user_workloads_config_map( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Gets an existing user workloads ConfigMap. @@ -2440,8 +2506,10 @@ async def sample_get_user_workloads_config_map(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsConfigMap: @@ -2505,7 +2573,7 @@ async def list_user_workloads_config_maps( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListUserWorkloadsConfigMapsAsyncPager: r"""Lists user workloads ConfigMaps. @@ -2554,8 +2622,10 @@ async def sample_list_user_workloads_config_maps(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListUserWorkloadsConfigMapsAsyncPager: @@ -2632,7 +2702,7 @@ async def update_user_workloads_config_map( user_workloads_config_map: Optional[environments.UserWorkloadsConfigMap] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Updates a user workloads ConfigMap. @@ -2678,8 +2748,10 @@ async def sample_update_user_workloads_config_map(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsConfigMap: @@ -2750,7 +2822,7 @@ async def delete_user_workloads_config_map( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a user workloads ConfigMap. @@ -2795,8 +2867,10 @@ async def sample_delete_user_workloads_config_map(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -2847,7 +2921,7 @@ async def save_snapshot( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Creates a snapshots of a Cloud Composer environment. @@ -2891,8 +2965,10 @@ async def sample_save_snapshot(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -2951,7 +3027,7 @@ async def load_snapshot( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Loads a snapshot of a Cloud Composer environment. @@ -2995,8 +3071,10 @@ async def sample_load_snapshot(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -3055,7 +3133,7 @@ async def database_failover( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation_async.AsyncOperation: r"""Triggers database failover (only for highly resilient environments). @@ -3097,8 +3175,10 @@ async def sample_database_failover(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation_async.AsyncOperation: @@ -3159,7 +3239,7 @@ async def fetch_database_properties( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.FetchDatabasePropertiesResponse: r"""Fetches database properties. @@ -3196,8 +3276,10 @@ async def sample_fetch_database_properties(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.FetchDatabasePropertiesResponse: @@ -3245,7 +3327,7 @@ async def list_operations( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -3256,8 +3338,10 @@ async def list_operations( retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.ListOperationsResponse: Response message for ``ListOperations`` method. @@ -3298,7 +3382,7 @@ async def get_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -3309,8 +3393,10 @@ async def get_operation( retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: An ``Operation`` object. @@ -3351,7 +3437,7 @@ async def delete_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a long-running operation. @@ -3367,8 +3453,10 @@ async def delete_operation( retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: None """ diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/client.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/client.py index bd06871bb6f0..5fd7a8248560 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/client.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/client.py @@ -14,6 +14,7 @@ # limitations under the License. # from collections import OrderedDict +import logging as std_logging import os import re from typing import ( @@ -50,6 +51,15 @@ except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore from google.longrunning import operations_pb2 # type: ignore @@ -640,6 +650,10 @@ def __init__( # Initialize the universe domain validation. self._is_universe_domain_valid = False + if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER + # Setup logging. + client_logging.initialize_logging() + api_key_value = getattr(self._client_options, "api_key", None) if api_key_value and credentials: raise ValueError( @@ -702,6 +716,29 @@ def __init__( api_audience=self._client_options.api_audience, ) + if "async" not in str(self._transport): + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient`.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "universeDomain": getattr( + self._transport._credentials, "universe_domain", "" + ), + "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}", + "credentialsInfo": getattr( + self.transport._credentials, "get_cred_info", lambda: None + )(), + } + if hasattr(self._transport, "_credentials") + else { + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "credentialsType": None, + }, + ) + def create_environment( self, request: Optional[Union[environments.CreateEnvironmentRequest, dict]] = None, @@ -710,7 +747,7 @@ def create_environment( environment: Optional[environments.Environment] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Create a new environment. @@ -761,8 +798,10 @@ def sample_create_environment(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -833,7 +872,7 @@ def get_environment( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.Environment: r"""Get an existing environment. @@ -876,8 +915,10 @@ def sample_get_environment(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.Environment: @@ -935,7 +976,7 @@ def list_environments( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListEnvironmentsPager: r"""List environments. @@ -980,8 +1021,10 @@ def sample_list_environments(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListEnvironmentsPager: @@ -1055,7 +1098,7 @@ def update_environment( update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Update an environment. @@ -1330,8 +1373,10 @@ def sample_update_environment(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -1404,7 +1449,7 @@ def delete_environment( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Delete an environment. @@ -1451,8 +1496,10 @@ def sample_delete_environment(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -1527,7 +1574,7 @@ def restart_web_server( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Restart Airflow web server. @@ -1566,8 +1613,10 @@ def sample_restart_web_server(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -1622,7 +1671,7 @@ def check_upgrade( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Check if an upgrade operation on the environment will succeed. @@ -1665,8 +1714,10 @@ def sample_check_upgrade(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -1724,7 +1775,7 @@ def execute_airflow_command( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ExecuteAirflowCommandResponse: r"""Executes Airflow CLI command. @@ -1759,8 +1810,10 @@ def sample_execute_airflow_command(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.ExecuteAirflowCommandResponse: @@ -1806,7 +1859,7 @@ def stop_airflow_command( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.StopAirflowCommandResponse: r"""Stops Airflow CLI command execution. @@ -1841,8 +1894,10 @@ def sample_stop_airflow_command(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.StopAirflowCommandResponse: @@ -1888,7 +1943,7 @@ def poll_airflow_command( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.PollAirflowCommandResponse: r"""Polls Airflow CLI command execution and fetches logs. @@ -1923,8 +1978,10 @@ def sample_poll_airflow_command(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.PollAirflowCommandResponse: @@ -1971,7 +2028,7 @@ def list_workloads( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListWorkloadsPager: r"""Lists workloads in a Cloud Composer environment. Workload is a unit that runs a single Composer component. @@ -2021,8 +2078,10 @@ def sample_list_workloads(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListWorkloadsPager: @@ -2097,7 +2156,7 @@ def create_user_workloads_secret( user_workloads_secret: Optional[environments.UserWorkloadsSecret] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Creates a user workloads Secret. @@ -2151,8 +2210,10 @@ def sample_create_user_workloads_secret(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsSecret: @@ -2217,7 +2278,7 @@ def get_user_workloads_secret( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Gets an existing user workloads Secret. Values of the "data" field in the response are cleared. @@ -2265,8 +2326,10 @@ def sample_get_user_workloads_secret(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsSecret: @@ -2329,7 +2392,7 @@ def list_user_workloads_secrets( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListUserWorkloadsSecretsPager: r"""Lists user workloads Secrets. @@ -2377,8 +2440,10 @@ def sample_list_user_workloads_secrets(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListUserWorkloadsSecretsPager: @@ -2454,7 +2519,7 @@ def update_user_workloads_secret( user_workloads_secret: Optional[environments.UserWorkloadsSecret] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Updates a user workloads Secret. @@ -2499,8 +2564,10 @@ def sample_update_user_workloads_secret(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsSecret: @@ -2565,7 +2632,7 @@ def delete_user_workloads_secret( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a user workloads Secret. @@ -2609,8 +2676,10 @@ def sample_delete_user_workloads_secret(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -2664,7 +2733,7 @@ def create_user_workloads_config_map( user_workloads_config_map: Optional[environments.UserWorkloadsConfigMap] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Creates a user workloads ConfigMap. @@ -2719,8 +2788,10 @@ def sample_create_user_workloads_config_map(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsConfigMap: @@ -2785,7 +2856,7 @@ def get_user_workloads_config_map( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Gets an existing user workloads ConfigMap. @@ -2832,8 +2903,10 @@ def sample_get_user_workloads_config_map(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsConfigMap: @@ -2896,7 +2969,7 @@ def list_user_workloads_config_maps( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListUserWorkloadsConfigMapsPager: r"""Lists user workloads ConfigMaps. @@ -2945,8 +3018,10 @@ def sample_list_user_workloads_config_maps(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListUserWorkloadsConfigMapsPager: @@ -3022,7 +3097,7 @@ def update_user_workloads_config_map( user_workloads_config_map: Optional[environments.UserWorkloadsConfigMap] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Updates a user workloads ConfigMap. @@ -3068,8 +3143,10 @@ def sample_update_user_workloads_config_map(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsConfigMap: @@ -3139,7 +3216,7 @@ def delete_user_workloads_config_map( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a user workloads ConfigMap. @@ -3184,8 +3261,10 @@ def sample_delete_user_workloads_config_map(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -3235,7 +3314,7 @@ def save_snapshot( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Creates a snapshots of a Cloud Composer environment. @@ -3279,8 +3358,10 @@ def sample_save_snapshot(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -3337,7 +3418,7 @@ def load_snapshot( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Loads a snapshot of a Cloud Composer environment. @@ -3381,8 +3462,10 @@ def sample_load_snapshot(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -3439,7 +3522,7 @@ def database_failover( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operation.Operation: r"""Triggers database failover (only for highly resilient environments). @@ -3481,8 +3564,10 @@ def sample_database_failover(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.api_core.operation.Operation: @@ -3541,7 +3626,7 @@ def fetch_database_properties( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.FetchDatabasePropertiesResponse: r"""Fetches database properties. @@ -3578,8 +3663,10 @@ def sample_fetch_database_properties(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.types.FetchDatabasePropertiesResponse: @@ -3640,7 +3727,7 @@ def list_operations( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -3651,8 +3738,10 @@ def list_operations( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.ListOperationsResponse: Response message for ``ListOperations`` method. @@ -3693,7 +3782,7 @@ def get_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -3704,8 +3793,10 @@ def get_operation( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: An ``Operation`` object. @@ -3746,7 +3837,7 @@ def delete_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a long-running operation. @@ -3762,8 +3853,10 @@ def delete_operation( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: None """ diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/pagers.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/pagers.py index 4f925319ea37..de79e4470786 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/pagers.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/pagers.py @@ -67,7 +67,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -81,8 +81,10 @@ def __init__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListEnvironmentsRequest(request) @@ -141,7 +143,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -155,8 +157,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListEnvironmentsRequest(request) @@ -219,7 +223,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -233,8 +237,10 @@ def __init__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListWorkloadsRequest(request) @@ -293,7 +299,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -307,8 +313,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListWorkloadsRequest(request) @@ -373,7 +381,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -387,8 +395,10 @@ def __init__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListUserWorkloadsSecretsRequest(request) @@ -447,7 +457,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -461,8 +471,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListUserWorkloadsSecretsRequest(request) @@ -527,7 +539,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -541,8 +553,10 @@ def __init__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListUserWorkloadsConfigMapsRequest(request) @@ -603,7 +617,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -617,8 +631,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = environments.ListUserWorkloadsConfigMapsRequest(request) diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/grpc.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/grpc.py index 6acb73c34b4e..e92d09f5d29f 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/grpc.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/grpc.py @@ -13,6 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import json +import logging as std_logging +import pickle from typing import Callable, Dict, Optional, Sequence, Tuple, Union import warnings @@ -22,12 +25,90 @@ from google.auth.transport.grpc import SslCredentials # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.orchestration.airflow.service_v1beta1.types import environments from .base import DEFAULT_CLIENT_INFO, EnvironmentsTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER + def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": client_call_details.method, + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + + response = continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = ( + dict([(k, str(v)) for k, v in response_metadata]) + if response_metadata + else None + ) + result = response.result() + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response for {client_call_details.method}.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class EnvironmentsGrpcTransport(EnvironmentsTransport): """gRPC backend transport for Environments. @@ -182,7 +263,12 @@ def __init__( ], ) - # Wrap messages. This must be done after self._grpc_channel exists + self._interceptor = _LoggingClientInterceptor() + self._logged_channel = grpc.intercept_channel( + self._grpc_channel, self._interceptor + ) + + # Wrap messages. This must be done after self._logged_channel exists self._prep_wrapped_messages(client_info) @classmethod @@ -246,7 +332,9 @@ def operations_client(self) -> operations_v1.OperationsClient: """ # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient(self.grpc_channel) + self._operations_client = operations_v1.OperationsClient( + self._logged_channel + ) # Return the client from cache. return self._operations_client @@ -270,7 +358,7 @@ def create_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_environment" not in self._stubs: - self._stubs["create_environment"] = self.grpc_channel.unary_unary( + self._stubs["create_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/CreateEnvironment", request_serializer=environments.CreateEnvironmentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -296,7 +384,7 @@ def get_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_environment" not in self._stubs: - self._stubs["get_environment"] = self.grpc_channel.unary_unary( + self._stubs["get_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/GetEnvironment", request_serializer=environments.GetEnvironmentRequest.serialize, response_deserializer=environments.Environment.deserialize, @@ -324,7 +412,7 @@ def list_environments( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_environments" not in self._stubs: - self._stubs["list_environments"] = self.grpc_channel.unary_unary( + self._stubs["list_environments"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/ListEnvironments", request_serializer=environments.ListEnvironmentsRequest.serialize, response_deserializer=environments.ListEnvironmentsResponse.deserialize, @@ -350,7 +438,7 @@ def update_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_environment" not in self._stubs: - self._stubs["update_environment"] = self.grpc_channel.unary_unary( + self._stubs["update_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/UpdateEnvironment", request_serializer=environments.UpdateEnvironmentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -376,7 +464,7 @@ def delete_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_environment" not in self._stubs: - self._stubs["delete_environment"] = self.grpc_channel.unary_unary( + self._stubs["delete_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/DeleteEnvironment", request_serializer=environments.DeleteEnvironmentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -402,7 +490,7 @@ def restart_web_server( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "restart_web_server" not in self._stubs: - self._stubs["restart_web_server"] = self.grpc_channel.unary_unary( + self._stubs["restart_web_server"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/RestartWebServer", request_serializer=environments.RestartWebServerRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -431,7 +519,7 @@ def check_upgrade( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "check_upgrade" not in self._stubs: - self._stubs["check_upgrade"] = self.grpc_channel.unary_unary( + self._stubs["check_upgrade"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/CheckUpgrade", request_serializer=environments.CheckUpgradeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -460,7 +548,7 @@ def execute_airflow_command( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "execute_airflow_command" not in self._stubs: - self._stubs["execute_airflow_command"] = self.grpc_channel.unary_unary( + self._stubs["execute_airflow_command"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/ExecuteAirflowCommand", request_serializer=environments.ExecuteAirflowCommandRequest.serialize, response_deserializer=environments.ExecuteAirflowCommandResponse.deserialize, @@ -489,7 +577,7 @@ def stop_airflow_command( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stop_airflow_command" not in self._stubs: - self._stubs["stop_airflow_command"] = self.grpc_channel.unary_unary( + self._stubs["stop_airflow_command"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/StopAirflowCommand", request_serializer=environments.StopAirflowCommandRequest.serialize, response_deserializer=environments.StopAirflowCommandResponse.deserialize, @@ -518,7 +606,7 @@ def poll_airflow_command( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "poll_airflow_command" not in self._stubs: - self._stubs["poll_airflow_command"] = self.grpc_channel.unary_unary( + self._stubs["poll_airflow_command"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/PollAirflowCommand", request_serializer=environments.PollAirflowCommandRequest.serialize, response_deserializer=environments.PollAirflowCommandResponse.deserialize, @@ -550,7 +638,7 @@ def list_workloads( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_workloads" not in self._stubs: - self._stubs["list_workloads"] = self.grpc_channel.unary_unary( + self._stubs["list_workloads"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/ListWorkloads", request_serializer=environments.ListWorkloadsRequest.serialize, response_deserializer=environments.ListWorkloadsResponse.deserialize, @@ -582,7 +670,9 @@ def create_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_user_workloads_secret" not in self._stubs: - self._stubs["create_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_user_workloads_secret" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/CreateUserWorkloadsSecret", request_serializer=environments.CreateUserWorkloadsSecretRequest.serialize, response_deserializer=environments.UserWorkloadsSecret.deserialize, @@ -614,7 +704,7 @@ def get_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_user_workloads_secret" not in self._stubs: - self._stubs["get_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs["get_user_workloads_secret"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/GetUserWorkloadsSecret", request_serializer=environments.GetUserWorkloadsSecretRequest.serialize, response_deserializer=environments.UserWorkloadsSecret.deserialize, @@ -646,7 +736,9 @@ def list_user_workloads_secrets( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_user_workloads_secrets" not in self._stubs: - self._stubs["list_user_workloads_secrets"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_user_workloads_secrets" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/ListUserWorkloadsSecrets", request_serializer=environments.ListUserWorkloadsSecretsRequest.serialize, response_deserializer=environments.ListUserWorkloadsSecretsResponse.deserialize, @@ -678,7 +770,9 @@ def update_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_user_workloads_secret" not in self._stubs: - self._stubs["update_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_user_workloads_secret" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/UpdateUserWorkloadsSecret", request_serializer=environments.UpdateUserWorkloadsSecretRequest.serialize, response_deserializer=environments.UserWorkloadsSecret.deserialize, @@ -707,7 +801,9 @@ def delete_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_user_workloads_secret" not in self._stubs: - self._stubs["delete_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_user_workloads_secret" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/DeleteUserWorkloadsSecret", request_serializer=environments.DeleteUserWorkloadsSecretRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -742,7 +838,7 @@ def create_user_workloads_config_map( if "create_user_workloads_config_map" not in self._stubs: self._stubs[ "create_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/CreateUserWorkloadsConfigMap", request_serializer=environments.CreateUserWorkloadsConfigMapRequest.serialize, response_deserializer=environments.UserWorkloadsConfigMap.deserialize, @@ -776,7 +872,7 @@ def get_user_workloads_config_map( if "get_user_workloads_config_map" not in self._stubs: self._stubs[ "get_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/GetUserWorkloadsConfigMap", request_serializer=environments.GetUserWorkloadsConfigMapRequest.serialize, response_deserializer=environments.UserWorkloadsConfigMap.deserialize, @@ -811,7 +907,7 @@ def list_user_workloads_config_maps( if "list_user_workloads_config_maps" not in self._stubs: self._stubs[ "list_user_workloads_config_maps" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/ListUserWorkloadsConfigMaps", request_serializer=environments.ListUserWorkloadsConfigMapsRequest.serialize, response_deserializer=environments.ListUserWorkloadsConfigMapsResponse.deserialize, @@ -846,7 +942,7 @@ def update_user_workloads_config_map( if "update_user_workloads_config_map" not in self._stubs: self._stubs[ "update_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/UpdateUserWorkloadsConfigMap", request_serializer=environments.UpdateUserWorkloadsConfigMapRequest.serialize, response_deserializer=environments.UserWorkloadsConfigMap.deserialize, @@ -878,7 +974,7 @@ def delete_user_workloads_config_map( if "delete_user_workloads_config_map" not in self._stubs: self._stubs[ "delete_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/DeleteUserWorkloadsConfigMap", request_serializer=environments.DeleteUserWorkloadsConfigMapRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -908,7 +1004,7 @@ def save_snapshot( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "save_snapshot" not in self._stubs: - self._stubs["save_snapshot"] = self.grpc_channel.unary_unary( + self._stubs["save_snapshot"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/SaveSnapshot", request_serializer=environments.SaveSnapshotRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -938,7 +1034,7 @@ def load_snapshot( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "load_snapshot" not in self._stubs: - self._stubs["load_snapshot"] = self.grpc_channel.unary_unary( + self._stubs["load_snapshot"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/LoadSnapshot", request_serializer=environments.LoadSnapshotRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -965,7 +1061,7 @@ def database_failover( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "database_failover" not in self._stubs: - self._stubs["database_failover"] = self.grpc_channel.unary_unary( + self._stubs["database_failover"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/DatabaseFailover", request_serializer=environments.DatabaseFailoverRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -994,7 +1090,7 @@ def fetch_database_properties( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "fetch_database_properties" not in self._stubs: - self._stubs["fetch_database_properties"] = self.grpc_channel.unary_unary( + self._stubs["fetch_database_properties"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/FetchDatabaseProperties", request_serializer=environments.FetchDatabasePropertiesRequest.serialize, response_deserializer=environments.FetchDatabasePropertiesResponse.deserialize, @@ -1002,7 +1098,7 @@ def fetch_database_properties( return self._stubs["fetch_database_properties"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -1014,7 +1110,7 @@ def delete_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + self._stubs["delete_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/DeleteOperation", request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, response_deserializer=None, @@ -1031,7 +1127,7 @@ def get_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( + self._stubs["get_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/GetOperation", request_serializer=operations_pb2.GetOperationRequest.SerializeToString, response_deserializer=operations_pb2.Operation.FromString, @@ -1050,7 +1146,7 @@ def list_operations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( + self._stubs["list_operations"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/ListOperations", request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, response_deserializer=operations_pb2.ListOperationsResponse.FromString, diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/grpc_asyncio.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/grpc_asyncio.py index a0c8bce711b5..77b0120283bc 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/grpc_asyncio.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import logging as std_logging +import pickle from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union import warnings @@ -24,14 +27,93 @@ from google.auth.transport.grpc import SslCredentials # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore from grpc.experimental import aio # type: ignore +import proto # type: ignore from google.cloud.orchestration.airflow.service_v1beta1.types import environments from .base import DEFAULT_CLIENT_INFO, EnvironmentsTransport from .grpc import EnvironmentsGrpcTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientAIOInterceptor( + grpc.aio.UnaryUnaryClientInterceptor +): # pragma: NO COVER + async def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": str(client_call_details.method), + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + response = await continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = await response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = ( + dict([(k, str(v)) for k, v in response_metadata]) + if response_metadata + else None + ) + result = await response + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response to rpc {client_call_details.method}.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class EnvironmentsGrpcAsyncIOTransport(EnvironmentsTransport): """gRPC AsyncIO backend transport for Environments. @@ -229,10 +311,13 @@ def __init__( ], ) - # Wrap messages. This must be done after self._grpc_channel exists + self._interceptor = _LoggingClientAIOInterceptor() + self._grpc_channel._unary_unary_interceptors.append(self._interceptor) + self._logged_channel = self._grpc_channel self._wrap_with_kind = ( "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters ) + # Wrap messages. This must be done after self._logged_channel exists self._prep_wrapped_messages(client_info) @property @@ -255,7 +340,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel + self._logged_channel ) # Return the client from cache. @@ -282,7 +367,7 @@ def create_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_environment" not in self._stubs: - self._stubs["create_environment"] = self.grpc_channel.unary_unary( + self._stubs["create_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/CreateEnvironment", request_serializer=environments.CreateEnvironmentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -310,7 +395,7 @@ def get_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_environment" not in self._stubs: - self._stubs["get_environment"] = self.grpc_channel.unary_unary( + self._stubs["get_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/GetEnvironment", request_serializer=environments.GetEnvironmentRequest.serialize, response_deserializer=environments.Environment.deserialize, @@ -339,7 +424,7 @@ def list_environments( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_environments" not in self._stubs: - self._stubs["list_environments"] = self.grpc_channel.unary_unary( + self._stubs["list_environments"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/ListEnvironments", request_serializer=environments.ListEnvironmentsRequest.serialize, response_deserializer=environments.ListEnvironmentsResponse.deserialize, @@ -367,7 +452,7 @@ def update_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_environment" not in self._stubs: - self._stubs["update_environment"] = self.grpc_channel.unary_unary( + self._stubs["update_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/UpdateEnvironment", request_serializer=environments.UpdateEnvironmentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -395,7 +480,7 @@ def delete_environment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_environment" not in self._stubs: - self._stubs["delete_environment"] = self.grpc_channel.unary_unary( + self._stubs["delete_environment"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/DeleteEnvironment", request_serializer=environments.DeleteEnvironmentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -423,7 +508,7 @@ def restart_web_server( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "restart_web_server" not in self._stubs: - self._stubs["restart_web_server"] = self.grpc_channel.unary_unary( + self._stubs["restart_web_server"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/RestartWebServer", request_serializer=environments.RestartWebServerRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -454,7 +539,7 @@ def check_upgrade( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "check_upgrade" not in self._stubs: - self._stubs["check_upgrade"] = self.grpc_channel.unary_unary( + self._stubs["check_upgrade"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/CheckUpgrade", request_serializer=environments.CheckUpgradeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -483,7 +568,7 @@ def execute_airflow_command( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "execute_airflow_command" not in self._stubs: - self._stubs["execute_airflow_command"] = self.grpc_channel.unary_unary( + self._stubs["execute_airflow_command"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/ExecuteAirflowCommand", request_serializer=environments.ExecuteAirflowCommandRequest.serialize, response_deserializer=environments.ExecuteAirflowCommandResponse.deserialize, @@ -512,7 +597,7 @@ def stop_airflow_command( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stop_airflow_command" not in self._stubs: - self._stubs["stop_airflow_command"] = self.grpc_channel.unary_unary( + self._stubs["stop_airflow_command"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/StopAirflowCommand", request_serializer=environments.StopAirflowCommandRequest.serialize, response_deserializer=environments.StopAirflowCommandResponse.deserialize, @@ -541,7 +626,7 @@ def poll_airflow_command( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "poll_airflow_command" not in self._stubs: - self._stubs["poll_airflow_command"] = self.grpc_channel.unary_unary( + self._stubs["poll_airflow_command"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/PollAirflowCommand", request_serializer=environments.PollAirflowCommandRequest.serialize, response_deserializer=environments.PollAirflowCommandResponse.deserialize, @@ -574,7 +659,7 @@ def list_workloads( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_workloads" not in self._stubs: - self._stubs["list_workloads"] = self.grpc_channel.unary_unary( + self._stubs["list_workloads"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/ListWorkloads", request_serializer=environments.ListWorkloadsRequest.serialize, response_deserializer=environments.ListWorkloadsResponse.deserialize, @@ -606,7 +691,9 @@ def create_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_user_workloads_secret" not in self._stubs: - self._stubs["create_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_user_workloads_secret" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/CreateUserWorkloadsSecret", request_serializer=environments.CreateUserWorkloadsSecretRequest.serialize, response_deserializer=environments.UserWorkloadsSecret.deserialize, @@ -639,7 +726,7 @@ def get_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_user_workloads_secret" not in self._stubs: - self._stubs["get_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs["get_user_workloads_secret"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/GetUserWorkloadsSecret", request_serializer=environments.GetUserWorkloadsSecretRequest.serialize, response_deserializer=environments.UserWorkloadsSecret.deserialize, @@ -671,7 +758,9 @@ def list_user_workloads_secrets( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_user_workloads_secrets" not in self._stubs: - self._stubs["list_user_workloads_secrets"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_user_workloads_secrets" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/ListUserWorkloadsSecrets", request_serializer=environments.ListUserWorkloadsSecretsRequest.serialize, response_deserializer=environments.ListUserWorkloadsSecretsResponse.deserialize, @@ -703,7 +792,9 @@ def update_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_user_workloads_secret" not in self._stubs: - self._stubs["update_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_user_workloads_secret" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/UpdateUserWorkloadsSecret", request_serializer=environments.UpdateUserWorkloadsSecretRequest.serialize, response_deserializer=environments.UserWorkloadsSecret.deserialize, @@ -734,7 +825,9 @@ def delete_user_workloads_secret( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_user_workloads_secret" not in self._stubs: - self._stubs["delete_user_workloads_secret"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_user_workloads_secret" + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/DeleteUserWorkloadsSecret", request_serializer=environments.DeleteUserWorkloadsSecretRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -769,7 +862,7 @@ def create_user_workloads_config_map( if "create_user_workloads_config_map" not in self._stubs: self._stubs[ "create_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/CreateUserWorkloadsConfigMap", request_serializer=environments.CreateUserWorkloadsConfigMapRequest.serialize, response_deserializer=environments.UserWorkloadsConfigMap.deserialize, @@ -803,7 +896,7 @@ def get_user_workloads_config_map( if "get_user_workloads_config_map" not in self._stubs: self._stubs[ "get_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/GetUserWorkloadsConfigMap", request_serializer=environments.GetUserWorkloadsConfigMapRequest.serialize, response_deserializer=environments.UserWorkloadsConfigMap.deserialize, @@ -838,7 +931,7 @@ def list_user_workloads_config_maps( if "list_user_workloads_config_maps" not in self._stubs: self._stubs[ "list_user_workloads_config_maps" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/ListUserWorkloadsConfigMaps", request_serializer=environments.ListUserWorkloadsConfigMapsRequest.serialize, response_deserializer=environments.ListUserWorkloadsConfigMapsResponse.deserialize, @@ -873,7 +966,7 @@ def update_user_workloads_config_map( if "update_user_workloads_config_map" not in self._stubs: self._stubs[ "update_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/UpdateUserWorkloadsConfigMap", request_serializer=environments.UpdateUserWorkloadsConfigMapRequest.serialize, response_deserializer=environments.UserWorkloadsConfigMap.deserialize, @@ -907,7 +1000,7 @@ def delete_user_workloads_config_map( if "delete_user_workloads_config_map" not in self._stubs: self._stubs[ "delete_user_workloads_config_map" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/DeleteUserWorkloadsConfigMap", request_serializer=environments.DeleteUserWorkloadsConfigMapRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -939,7 +1032,7 @@ def save_snapshot( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "save_snapshot" not in self._stubs: - self._stubs["save_snapshot"] = self.grpc_channel.unary_unary( + self._stubs["save_snapshot"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/SaveSnapshot", request_serializer=environments.SaveSnapshotRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -971,7 +1064,7 @@ def load_snapshot( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "load_snapshot" not in self._stubs: - self._stubs["load_snapshot"] = self.grpc_channel.unary_unary( + self._stubs["load_snapshot"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/LoadSnapshot", request_serializer=environments.LoadSnapshotRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1000,7 +1093,7 @@ def database_failover( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "database_failover" not in self._stubs: - self._stubs["database_failover"] = self.grpc_channel.unary_unary( + self._stubs["database_failover"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/DatabaseFailover", request_serializer=environments.DatabaseFailoverRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1029,7 +1122,7 @@ def fetch_database_properties( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "fetch_database_properties" not in self._stubs: - self._stubs["fetch_database_properties"] = self.grpc_channel.unary_unary( + self._stubs["fetch_database_properties"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.Environments/FetchDatabaseProperties", request_serializer=environments.FetchDatabasePropertiesRequest.serialize, response_deserializer=environments.FetchDatabasePropertiesResponse.deserialize, @@ -1187,7 +1280,7 @@ def _wrap_method(self, func, *args, **kwargs): return gapic_v1.method_async.wrap_method(func, *args, **kwargs) def close(self): - return self.grpc_channel.close() + return self._logged_channel.close() @property def kind(self) -> str: @@ -1203,7 +1296,7 @@ def delete_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + self._stubs["delete_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/DeleteOperation", request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, response_deserializer=None, @@ -1220,7 +1313,7 @@ def get_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( + self._stubs["get_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/GetOperation", request_serializer=operations_pb2.GetOperationRequest.SerializeToString, response_deserializer=operations_pb2.Operation.FromString, @@ -1239,7 +1332,7 @@ def list_operations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( + self._stubs["list_operations"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/ListOperations", request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, response_deserializer=operations_pb2.ListOperationsResponse.FromString, diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/rest.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/rest.py index e3100b9358d8..213d8286c44a 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/rest.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/rest.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import dataclasses import json # type: ignore +import logging from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings @@ -39,6 +39,14 @@ except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = logging.getLogger(__name__) DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, @@ -263,8 +271,10 @@ def post_update_user_workloads_secret(self, response): def pre_check_upgrade( self, request: environments.CheckUpgradeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.CheckUpgradeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.CheckUpgradeRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for check_upgrade Override in a subclass to manipulate the request or metadata @@ -286,8 +296,10 @@ def post_check_upgrade( def pre_create_environment( self, request: environments.CreateEnvironmentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.CreateEnvironmentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.CreateEnvironmentRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_environment Override in a subclass to manipulate the request or metadata @@ -309,9 +321,10 @@ def post_create_environment( def pre_create_user_workloads_config_map( self, request: environments.CreateUserWorkloadsConfigMapRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.CreateUserWorkloadsConfigMapRequest, Sequence[Tuple[str, str]] + environments.CreateUserWorkloadsConfigMapRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_user_workloads_config_map @@ -334,9 +347,10 @@ def post_create_user_workloads_config_map( def pre_create_user_workloads_secret( self, request: environments.CreateUserWorkloadsSecretRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.CreateUserWorkloadsSecretRequest, Sequence[Tuple[str, str]] + environments.CreateUserWorkloadsSecretRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_user_workloads_secret @@ -359,8 +373,10 @@ def post_create_user_workloads_secret( def pre_database_failover( self, request: environments.DatabaseFailoverRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.DatabaseFailoverRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.DatabaseFailoverRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for database_failover Override in a subclass to manipulate the request or metadata @@ -382,8 +398,10 @@ def post_database_failover( def pre_delete_environment( self, request: environments.DeleteEnvironmentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.DeleteEnvironmentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.DeleteEnvironmentRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_environment Override in a subclass to manipulate the request or metadata @@ -405,9 +423,10 @@ def post_delete_environment( def pre_delete_user_workloads_config_map( self, request: environments.DeleteUserWorkloadsConfigMapRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.DeleteUserWorkloadsConfigMapRequest, Sequence[Tuple[str, str]] + environments.DeleteUserWorkloadsConfigMapRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_user_workloads_config_map @@ -419,9 +438,10 @@ def pre_delete_user_workloads_config_map( def pre_delete_user_workloads_secret( self, request: environments.DeleteUserWorkloadsSecretRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.DeleteUserWorkloadsSecretRequest, Sequence[Tuple[str, str]] + environments.DeleteUserWorkloadsSecretRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_user_workloads_secret @@ -433,8 +453,11 @@ def pre_delete_user_workloads_secret( def pre_execute_airflow_command( self, request: environments.ExecuteAirflowCommandRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.ExecuteAirflowCommandRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.ExecuteAirflowCommandRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for execute_airflow_command Override in a subclass to manipulate the request or metadata @@ -456,8 +479,11 @@ def post_execute_airflow_command( def pre_fetch_database_properties( self, request: environments.FetchDatabasePropertiesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.FetchDatabasePropertiesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.FetchDatabasePropertiesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for fetch_database_properties Override in a subclass to manipulate the request or metadata @@ -479,8 +505,10 @@ def post_fetch_database_properties( def pre_get_environment( self, request: environments.GetEnvironmentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.GetEnvironmentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.GetEnvironmentRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_environment Override in a subclass to manipulate the request or metadata @@ -502,9 +530,10 @@ def post_get_environment( def pre_get_user_workloads_config_map( self, request: environments.GetUserWorkloadsConfigMapRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.GetUserWorkloadsConfigMapRequest, Sequence[Tuple[str, str]] + environments.GetUserWorkloadsConfigMapRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_user_workloads_config_map @@ -527,8 +556,11 @@ def post_get_user_workloads_config_map( def pre_get_user_workloads_secret( self, request: environments.GetUserWorkloadsSecretRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.GetUserWorkloadsSecretRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.GetUserWorkloadsSecretRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_user_workloads_secret Override in a subclass to manipulate the request or metadata @@ -550,8 +582,10 @@ def post_get_user_workloads_secret( def pre_list_environments( self, request: environments.ListEnvironmentsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.ListEnvironmentsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.ListEnvironmentsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_environments Override in a subclass to manipulate the request or metadata @@ -573,9 +607,10 @@ def post_list_environments( def pre_list_user_workloads_config_maps( self, request: environments.ListUserWorkloadsConfigMapsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.ListUserWorkloadsConfigMapsRequest, Sequence[Tuple[str, str]] + environments.ListUserWorkloadsConfigMapsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_user_workloads_config_maps @@ -598,8 +633,11 @@ def post_list_user_workloads_config_maps( def pre_list_user_workloads_secrets( self, request: environments.ListUserWorkloadsSecretsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.ListUserWorkloadsSecretsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.ListUserWorkloadsSecretsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_user_workloads_secrets Override in a subclass to manipulate the request or metadata @@ -621,8 +659,10 @@ def post_list_user_workloads_secrets( def pre_list_workloads( self, request: environments.ListWorkloadsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.ListWorkloadsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.ListWorkloadsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_workloads Override in a subclass to manipulate the request or metadata @@ -644,8 +684,10 @@ def post_list_workloads( def pre_load_snapshot( self, request: environments.LoadSnapshotRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.LoadSnapshotRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.LoadSnapshotRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for load_snapshot Override in a subclass to manipulate the request or metadata @@ -667,8 +709,10 @@ def post_load_snapshot( def pre_poll_airflow_command( self, request: environments.PollAirflowCommandRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.PollAirflowCommandRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.PollAirflowCommandRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for poll_airflow_command Override in a subclass to manipulate the request or metadata @@ -690,8 +734,10 @@ def post_poll_airflow_command( def pre_restart_web_server( self, request: environments.RestartWebServerRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.RestartWebServerRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.RestartWebServerRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for restart_web_server Override in a subclass to manipulate the request or metadata @@ -713,8 +759,10 @@ def post_restart_web_server( def pre_save_snapshot( self, request: environments.SaveSnapshotRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.SaveSnapshotRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.SaveSnapshotRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for save_snapshot Override in a subclass to manipulate the request or metadata @@ -736,8 +784,10 @@ def post_save_snapshot( def pre_stop_airflow_command( self, request: environments.StopAirflowCommandRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.StopAirflowCommandRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.StopAirflowCommandRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for stop_airflow_command Override in a subclass to manipulate the request or metadata @@ -759,8 +809,10 @@ def post_stop_airflow_command( def pre_update_environment( self, request: environments.UpdateEnvironmentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[environments.UpdateEnvironmentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + environments.UpdateEnvironmentRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_environment Override in a subclass to manipulate the request or metadata @@ -782,9 +834,10 @@ def post_update_environment( def pre_update_user_workloads_config_map( self, request: environments.UpdateUserWorkloadsConfigMapRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.UpdateUserWorkloadsConfigMapRequest, Sequence[Tuple[str, str]] + environments.UpdateUserWorkloadsConfigMapRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_user_workloads_config_map @@ -807,9 +860,10 @@ def post_update_user_workloads_config_map( def pre_update_user_workloads_secret( self, request: environments.UpdateUserWorkloadsSecretRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - environments.UpdateUserWorkloadsSecretRequest, Sequence[Tuple[str, str]] + environments.UpdateUserWorkloadsSecretRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_user_workloads_secret @@ -832,8 +886,10 @@ def post_update_user_workloads_secret( def pre_delete_operation( self, request: operations_pb2.DeleteOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_operation Override in a subclass to manipulate the request or metadata @@ -853,8 +909,10 @@ def post_delete_operation(self, response: None) -> None: def pre_get_operation( self, request: operations_pb2.GetOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.GetOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_operation Override in a subclass to manipulate the request or metadata @@ -876,8 +934,10 @@ def post_get_operation( def pre_list_operations( self, request: operations_pb2.ListOperationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.ListOperationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_operations Override in a subclass to manipulate the request or metadata @@ -1065,7 +1125,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the check upgrade method over HTTP. @@ -1076,8 +1136,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -1090,6 +1152,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseCheckUpgrade._get_http_options() ) + request, metadata = self._interceptor.pre_check_upgrade(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseCheckUpgrade._get_transcoded_request( http_options, request @@ -1108,6 +1171,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.CheckUpgrade", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "CheckUpgrade", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._CheckUpgrade._get_response( self._host, @@ -1127,7 +1217,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_check_upgrade(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.check_upgrade", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "CheckUpgrade", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateEnvironment( @@ -1165,7 +1277,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the create environment method over HTTP. @@ -1175,8 +1287,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -1189,6 +1303,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseCreateEnvironment._get_http_options() ) + request, metadata = self._interceptor.pre_create_environment( request, metadata ) @@ -1205,6 +1320,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.CreateEnvironment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "CreateEnvironment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._CreateEnvironment._get_response( self._host, @@ -1224,7 +1366,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_environment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.create_environment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "CreateEnvironment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateUserWorkloadsConfigMap( @@ -1263,7 +1427,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Call the create user workloads config map method over HTTP. @@ -1275,8 +1439,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.UserWorkloadsConfigMap: @@ -1289,6 +1455,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseCreateUserWorkloadsConfigMap._get_http_options() ) + request, metadata = self._interceptor.pre_create_user_workloads_config_map( request, metadata ) @@ -1305,6 +1472,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.CreateUserWorkloadsConfigMap", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "CreateUserWorkloadsConfigMap", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._CreateUserWorkloadsConfigMap._get_response( @@ -1328,7 +1522,31 @@ def __call__( pb_resp = environments.UserWorkloadsConfigMap.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_user_workloads_config_map(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.UserWorkloadsConfigMap.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.create_user_workloads_config_map", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "CreateUserWorkloadsConfigMap", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateUserWorkloadsSecret( @@ -1367,7 +1585,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Call the create user workloads secret method over HTTP. @@ -1378,8 +1596,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.UserWorkloadsSecret: @@ -1392,6 +1612,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseCreateUserWorkloadsSecret._get_http_options() ) + request, metadata = self._interceptor.pre_create_user_workloads_secret( request, metadata ) @@ -1408,6 +1629,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.CreateUserWorkloadsSecret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "CreateUserWorkloadsSecret", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._CreateUserWorkloadsSecret._get_response( @@ -1431,7 +1679,31 @@ def __call__( pb_resp = environments.UserWorkloadsSecret.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_user_workloads_secret(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.UserWorkloadsSecret.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.create_user_workloads_secret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "CreateUserWorkloadsSecret", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DatabaseFailover( @@ -1469,7 +1741,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the database failover method over HTTP. @@ -1481,8 +1753,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -1495,6 +1769,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseDatabaseFailover._get_http_options() ) + request, metadata = self._interceptor.pre_database_failover( request, metadata ) @@ -1511,6 +1786,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.DatabaseFailover", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "DatabaseFailover", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._DatabaseFailover._get_response( self._host, @@ -1530,7 +1832,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_database_failover(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.database_failover", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "DatabaseFailover", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteEnvironment( @@ -1567,7 +1891,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the delete environment method over HTTP. @@ -1577,8 +1901,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -1591,6 +1917,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseDeleteEnvironment._get_http_options() ) + request, metadata = self._interceptor.pre_delete_environment( request, metadata ) @@ -1603,6 +1930,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.DeleteEnvironment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "DeleteEnvironment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._DeleteEnvironment._get_response( self._host, @@ -1621,7 +1975,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_delete_environment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.delete_environment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "DeleteEnvironment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteUserWorkloadsConfigMap( @@ -1659,7 +2035,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ): r"""Call the delete user workloads config map method over HTTP. @@ -1671,13 +2047,16 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ http_options = ( _BaseEnvironmentsRestTransport._BaseDeleteUserWorkloadsConfigMap._get_http_options() ) + request, metadata = self._interceptor.pre_delete_user_workloads_config_map( request, metadata ) @@ -1690,6 +2069,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.DeleteUserWorkloadsConfigMap", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "DeleteUserWorkloadsConfigMap", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._DeleteUserWorkloadsConfigMap._get_response( @@ -1742,7 +2148,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ): r"""Call the delete user workloads secret method over HTTP. @@ -1753,13 +2159,16 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ http_options = ( _BaseEnvironmentsRestTransport._BaseDeleteUserWorkloadsSecret._get_http_options() ) + request, metadata = self._interceptor.pre_delete_user_workloads_secret( request, metadata ) @@ -1772,6 +2181,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.DeleteUserWorkloadsSecret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "DeleteUserWorkloadsSecret", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._DeleteUserWorkloadsSecret._get_response( @@ -1824,7 +2260,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ExecuteAirflowCommandResponse: r"""Call the execute airflow command method over HTTP. @@ -1834,8 +2270,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.ExecuteAirflowCommandResponse: @@ -1847,6 +2285,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseExecuteAirflowCommand._get_http_options() ) + request, metadata = self._interceptor.pre_execute_airflow_command( request, metadata ) @@ -1863,6 +2302,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.ExecuteAirflowCommand", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "ExecuteAirflowCommand", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._ExecuteAirflowCommand._get_response( self._host, @@ -1884,7 +2350,31 @@ def __call__( pb_resp = environments.ExecuteAirflowCommandResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_execute_airflow_command(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + environments.ExecuteAirflowCommandResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.execute_airflow_command", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "ExecuteAirflowCommand", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _FetchDatabaseProperties( @@ -1922,7 +2412,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.FetchDatabasePropertiesResponse: r"""Call the fetch database properties method over HTTP. @@ -1933,8 +2423,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.FetchDatabasePropertiesResponse: @@ -1946,6 +2438,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseFetchDatabaseProperties._get_http_options() ) + request, metadata = self._interceptor.pre_fetch_database_properties( request, metadata ) @@ -1958,6 +2451,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.FetchDatabaseProperties", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "FetchDatabaseProperties", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._FetchDatabaseProperties._get_response( self._host, @@ -1978,7 +2498,31 @@ def __call__( pb_resp = environments.FetchDatabasePropertiesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_fetch_database_properties(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + environments.FetchDatabasePropertiesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.fetch_database_properties", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "FetchDatabaseProperties", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetEnvironment( @@ -2015,7 +2559,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.Environment: r"""Call the get environment method over HTTP. @@ -2025,8 +2569,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.Environment: @@ -2038,6 +2584,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseGetEnvironment._get_http_options() ) + request, metadata = self._interceptor.pre_get_environment(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseGetEnvironment._get_transcoded_request( http_options, request @@ -2048,6 +2595,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.GetEnvironment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "GetEnvironment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._GetEnvironment._get_response( self._host, @@ -2068,7 +2642,29 @@ def __call__( pb_resp = environments.Environment.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_environment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.Environment.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.get_environment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "GetEnvironment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetUserWorkloadsConfigMap( @@ -2106,7 +2702,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Call the get user workloads config map method over HTTP. @@ -2117,8 +2713,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.UserWorkloadsConfigMap: @@ -2131,6 +2729,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseGetUserWorkloadsConfigMap._get_http_options() ) + request, metadata = self._interceptor.pre_get_user_workloads_config_map( request, metadata ) @@ -2143,6 +2742,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.GetUserWorkloadsConfigMap", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "GetUserWorkloadsConfigMap", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._GetUserWorkloadsConfigMap._get_response( @@ -2165,7 +2791,31 @@ def __call__( pb_resp = environments.UserWorkloadsConfigMap.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_user_workloads_config_map(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.UserWorkloadsConfigMap.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.get_user_workloads_config_map", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "GetUserWorkloadsConfigMap", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetUserWorkloadsSecret( @@ -2202,7 +2852,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Call the get user workloads secret method over HTTP. @@ -2212,8 +2862,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.UserWorkloadsSecret: @@ -2226,6 +2878,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseGetUserWorkloadsSecret._get_http_options() ) + request, metadata = self._interceptor.pre_get_user_workloads_secret( request, metadata ) @@ -2238,6 +2891,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.GetUserWorkloadsSecret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "GetUserWorkloadsSecret", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._GetUserWorkloadsSecret._get_response( self._host, @@ -2258,7 +2938,31 @@ def __call__( pb_resp = environments.UserWorkloadsSecret.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_user_workloads_secret(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.UserWorkloadsSecret.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.get_user_workloads_secret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "GetUserWorkloadsSecret", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListEnvironments( @@ -2295,7 +2999,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ListEnvironmentsResponse: r"""Call the list environments method over HTTP. @@ -2306,8 +3010,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.ListEnvironmentsResponse: @@ -2319,6 +3025,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseListEnvironments._get_http_options() ) + request, metadata = self._interceptor.pre_list_environments( request, metadata ) @@ -2331,6 +3038,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.ListEnvironments", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "ListEnvironments", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._ListEnvironments._get_response( self._host, @@ -2351,7 +3085,31 @@ def __call__( pb_resp = environments.ListEnvironmentsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_environments(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.ListEnvironmentsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.list_environments", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "ListEnvironments", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListUserWorkloadsConfigMaps( @@ -2389,7 +3147,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ListUserWorkloadsConfigMapsResponse: r"""Call the list user workloads config maps method over HTTP. @@ -2401,8 +3159,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.ListUserWorkloadsConfigMapsResponse: @@ -2414,6 +3174,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseListUserWorkloadsConfigMaps._get_http_options() ) + request, metadata = self._interceptor.pre_list_user_workloads_config_maps( request, metadata ) @@ -2426,6 +3187,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.ListUserWorkloadsConfigMaps", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "ListUserWorkloadsConfigMaps", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._ListUserWorkloadsConfigMaps._get_response( @@ -2448,7 +3236,33 @@ def __call__( pb_resp = environments.ListUserWorkloadsConfigMapsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_user_workloads_config_maps(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + environments.ListUserWorkloadsConfigMapsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.list_user_workloads_config_maps", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "ListUserWorkloadsConfigMaps", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListUserWorkloadsSecrets( @@ -2486,7 +3300,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ListUserWorkloadsSecretsResponse: r"""Call the list user workloads secrets method over HTTP. @@ -2497,8 +3311,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.ListUserWorkloadsSecretsResponse: @@ -2510,6 +3326,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseListUserWorkloadsSecrets._get_http_options() ) + request, metadata = self._interceptor.pre_list_user_workloads_secrets( request, metadata ) @@ -2522,6 +3339,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.ListUserWorkloadsSecrets", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "ListUserWorkloadsSecrets", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._ListUserWorkloadsSecrets._get_response( @@ -2544,7 +3388,31 @@ def __call__( pb_resp = environments.ListUserWorkloadsSecretsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_user_workloads_secrets(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + environments.ListUserWorkloadsSecretsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.list_user_workloads_secrets", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "ListUserWorkloadsSecrets", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListWorkloads( @@ -2581,7 +3449,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.ListWorkloadsResponse: r"""Call the list workloads method over HTTP. @@ -2592,8 +3460,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.ListWorkloadsResponse: @@ -2603,6 +3473,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseListWorkloads._get_http_options() ) + request, metadata = self._interceptor.pre_list_workloads(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseListWorkloads._get_transcoded_request( http_options, request @@ -2613,6 +3484,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.ListWorkloads", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "ListWorkloads", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._ListWorkloads._get_response( self._host, @@ -2633,7 +3531,31 @@ def __call__( pb_resp = environments.ListWorkloadsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_workloads(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.ListWorkloadsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.list_workloads", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "ListWorkloads", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _LoadSnapshot( @@ -2671,7 +3593,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the load snapshot method over HTTP. @@ -2682,8 +3604,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -2696,6 +3620,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseLoadSnapshot._get_http_options() ) + request, metadata = self._interceptor.pre_load_snapshot(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseLoadSnapshot._get_transcoded_request( http_options, request @@ -2714,6 +3639,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.LoadSnapshot", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "LoadSnapshot", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._LoadSnapshot._get_response( self._host, @@ -2733,7 +3685,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_load_snapshot(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.load_snapshot", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "LoadSnapshot", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _PollAirflowCommand( @@ -2771,7 +3745,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.PollAirflowCommandResponse: r"""Call the poll airflow command method over HTTP. @@ -2781,8 +3755,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.PollAirflowCommandResponse: @@ -2794,6 +3770,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BasePollAirflowCommand._get_http_options() ) + request, metadata = self._interceptor.pre_poll_airflow_command( request, metadata ) @@ -2810,6 +3787,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.PollAirflowCommand", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "PollAirflowCommand", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._PollAirflowCommand._get_response( self._host, @@ -2831,7 +3835,31 @@ def __call__( pb_resp = environments.PollAirflowCommandResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_poll_airflow_command(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.PollAirflowCommandResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.poll_airflow_command", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "PollAirflowCommand", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RestartWebServer( @@ -2869,7 +3897,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the restart web server method over HTTP. @@ -2879,8 +3907,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -2893,6 +3923,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseRestartWebServer._get_http_options() ) + request, metadata = self._interceptor.pre_restart_web_server( request, metadata ) @@ -2909,6 +3940,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.RestartWebServer", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "RestartWebServer", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._RestartWebServer._get_response( self._host, @@ -2928,7 +3986,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_restart_web_server(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.restart_web_server", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "RestartWebServer", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SaveSnapshot( @@ -2966,7 +4046,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the save snapshot method over HTTP. @@ -2977,8 +4057,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -2991,6 +4073,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseSaveSnapshot._get_http_options() ) + request, metadata = self._interceptor.pre_save_snapshot(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseSaveSnapshot._get_transcoded_request( http_options, request @@ -3009,6 +4092,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.SaveSnapshot", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "SaveSnapshot", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._SaveSnapshot._get_response( self._host, @@ -3028,7 +4138,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_save_snapshot(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.save_snapshot", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "SaveSnapshot", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _StopAirflowCommand( @@ -3066,7 +4198,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.StopAirflowCommandResponse: r"""Call the stop airflow command method over HTTP. @@ -3076,8 +4208,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.StopAirflowCommandResponse: @@ -3089,6 +4223,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseStopAirflowCommand._get_http_options() ) + request, metadata = self._interceptor.pre_stop_airflow_command( request, metadata ) @@ -3105,6 +4240,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.StopAirflowCommand", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "StopAirflowCommand", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._StopAirflowCommand._get_response( self._host, @@ -3126,7 +4288,31 @@ def __call__( pb_resp = environments.StopAirflowCommandResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_stop_airflow_command(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.StopAirflowCommandResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.stop_airflow_command", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "StopAirflowCommand", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateEnvironment( @@ -3164,7 +4350,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the update environment method over HTTP. @@ -3174,8 +4360,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: @@ -3188,6 +4376,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseUpdateEnvironment._get_http_options() ) + request, metadata = self._interceptor.pre_update_environment( request, metadata ) @@ -3204,6 +4393,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.UpdateEnvironment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "UpdateEnvironment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._UpdateEnvironment._get_response( self._host, @@ -3223,7 +4439,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_environment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.update_environment", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "UpdateEnvironment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateUserWorkloadsConfigMap( @@ -3262,7 +4500,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsConfigMap: r"""Call the update user workloads config map method over HTTP. @@ -3274,8 +4512,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.UserWorkloadsConfigMap: @@ -3288,6 +4528,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseUpdateUserWorkloadsConfigMap._get_http_options() ) + request, metadata = self._interceptor.pre_update_user_workloads_config_map( request, metadata ) @@ -3304,6 +4545,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.UpdateUserWorkloadsConfigMap", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "UpdateUserWorkloadsConfigMap", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._UpdateUserWorkloadsConfigMap._get_response( @@ -3327,7 +4595,31 @@ def __call__( pb_resp = environments.UserWorkloadsConfigMap.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_user_workloads_config_map(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.UserWorkloadsConfigMap.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.update_user_workloads_config_map", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "UpdateUserWorkloadsConfigMap", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateUserWorkloadsSecret( @@ -3366,7 +4658,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> environments.UserWorkloadsSecret: r"""Call the update user workloads secret method over HTTP. @@ -3377,8 +4669,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.environments.UserWorkloadsSecret: @@ -3391,6 +4685,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseUpdateUserWorkloadsSecret._get_http_options() ) + request, metadata = self._interceptor.pre_update_user_workloads_secret( request, metadata ) @@ -3407,6 +4702,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.UpdateUserWorkloadsSecret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "UpdateUserWorkloadsSecret", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EnvironmentsRestTransport._UpdateUserWorkloadsSecret._get_response( @@ -3430,7 +4752,31 @@ def __call__( pb_resp = environments.UserWorkloadsSecret.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_user_workloads_secret(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = environments.UserWorkloadsSecret.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.update_user_workloads_secret", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "UpdateUserWorkloadsSecret", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3710,7 +5056,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Call the delete operation method over HTTP. @@ -3720,13 +5066,16 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ http_options = ( _BaseEnvironmentsRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3739,6 +5088,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._DeleteOperation._get_response( self._host, @@ -3794,7 +5170,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the get operation method over HTTP. @@ -3804,8 +5180,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: operations_pb2.Operation: Response from GetOperation method. @@ -3814,6 +5192,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3826,6 +5205,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.GetOperation", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._GetOperation._get_response( self._host, @@ -3845,6 +5251,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_operation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3885,7 +5312,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Call the list operations method over HTTP. @@ -3895,8 +5322,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: operations_pb2.ListOperationsResponse: Response from ListOperations method. @@ -3905,6 +5334,7 @@ def __call__( http_options = ( _BaseEnvironmentsRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseEnvironmentsRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3915,6 +5345,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsClient.ListOperations", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EnvironmentsRestTransport._ListOperations._get_response( self._host, @@ -3934,6 +5391,27 @@ def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_operations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.EnvironmentsAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.Environments", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/async_client.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/async_client.py index c89f96ab534a..9bc7c1b63d26 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/async_client.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/async_client.py @@ -14,6 +14,7 @@ # limitations under the License. # from collections import OrderedDict +import logging as std_logging import re from typing import ( Callable, @@ -55,6 +56,15 @@ from .transports.base import DEFAULT_CLIENT_INFO, ImageVersionsTransport from .transports.grpc_asyncio import ImageVersionsGrpcAsyncIOTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + class ImageVersionsAsyncClient: """Readonly service to query available ImageVersions.""" @@ -258,6 +268,28 @@ def __init__( client_info=client_info, ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.cloud.orchestration.airflow.service_v1beta1.ImageVersionsAsyncClient`.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "universeDomain": getattr( + self._client._transport._credentials, "universe_domain", "" + ), + "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", + "credentialsInfo": getattr( + self.transport._credentials, "get_cred_info", lambda: None + )(), + } + if hasattr(self._client._transport, "_credentials") + else { + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "credentialsType": None, + }, + ) + async def list_image_versions( self, request: Optional[Union[image_versions.ListImageVersionsRequest, dict]] = None, @@ -265,7 +297,7 @@ async def list_image_versions( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListImageVersionsAsyncPager: r"""List ImageVersions for provided location. @@ -310,8 +342,10 @@ async def sample_list_image_versions(): retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.services.image_versions.pagers.ListImageVersionsAsyncPager: @@ -385,7 +419,7 @@ async def list_operations( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -396,8 +430,10 @@ async def list_operations( retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.ListOperationsResponse: Response message for ``ListOperations`` method. @@ -438,7 +474,7 @@ async def get_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -449,8 +485,10 @@ async def get_operation( retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: An ``Operation`` object. @@ -491,7 +529,7 @@ async def delete_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a long-running operation. @@ -507,8 +545,10 @@ async def delete_operation( retry (google.api_core.retry_async.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: None """ diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/client.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/client.py index 04ec1d5c5765..6b65b642f178 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/client.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/client.py @@ -14,6 +14,7 @@ # limitations under the License. # from collections import OrderedDict +import logging as std_logging import os import re from typing import ( @@ -50,6 +51,15 @@ except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + from google.longrunning import operations_pb2 # type: ignore from google.cloud.orchestration.airflow.service_v1beta1.services.image_versions import ( @@ -560,6 +570,10 @@ def __init__( # Initialize the universe domain validation. self._is_universe_domain_valid = False + if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER + # Setup logging. + client_logging.initialize_logging() + api_key_value = getattr(self._client_options, "api_key", None) if api_key_value and credentials: raise ValueError( @@ -625,6 +639,29 @@ def __init__( api_audience=self._client_options.api_audience, ) + if "async" not in str(self._transport): + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.cloud.orchestration.airflow.service_v1beta1.ImageVersionsClient`.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "universeDomain": getattr( + self._transport._credentials, "universe_domain", "" + ), + "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}", + "credentialsInfo": getattr( + self.transport._credentials, "get_cred_info", lambda: None + )(), + } + if hasattr(self._transport, "_credentials") + else { + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "credentialsType": None, + }, + ) + def list_image_versions( self, request: Optional[Union[image_versions.ListImageVersionsRequest, dict]] = None, @@ -632,7 +669,7 @@ def list_image_versions( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListImageVersionsPager: r"""List ImageVersions for provided location. @@ -677,8 +714,10 @@ def sample_list_image_versions(): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.cloud.orchestration.airflow.service_v1beta1.services.image_versions.pagers.ListImageVersionsPager: @@ -762,7 +801,7 @@ def list_operations( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -773,8 +812,10 @@ def list_operations( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.ListOperationsResponse: Response message for ``ListOperations`` method. @@ -815,7 +856,7 @@ def get_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -826,8 +867,10 @@ def get_operation( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.operations_pb2.Operation: An ``Operation`` object. @@ -868,7 +911,7 @@ def delete_operation( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a long-running operation. @@ -884,8 +927,10 @@ def delete_operation( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: None """ diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/pagers.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/pagers.py index 4377946da22d..8c887d742e9d 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/pagers.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/pagers.py @@ -67,7 +67,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -81,8 +81,10 @@ def __init__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = image_versions.ListImageVersionsRequest(request) @@ -141,7 +143,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -155,8 +157,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = image_versions.ListImageVersionsRequest(request) diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/grpc.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/grpc.py index fdb8735fc30e..5d95a82d8224 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/grpc.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/grpc.py @@ -13,6 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import json +import logging as std_logging +import pickle from typing import Callable, Dict, Optional, Sequence, Tuple, Union import warnings @@ -21,12 +24,90 @@ from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.longrunning import operations_pb2 # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.orchestration.airflow.service_v1beta1.types import image_versions from .base import DEFAULT_CLIENT_INFO, ImageVersionsTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER + def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "rpcName": client_call_details.method, + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + + response = continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = ( + dict([(k, str(v)) for k, v in response_metadata]) + if response_metadata + else None + ) + result = response.result() + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response for {client_call_details.method}.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ImageVersionsGrpcTransport(ImageVersionsTransport): """gRPC backend transport for ImageVersions. @@ -180,7 +261,12 @@ def __init__( ], ) - # Wrap messages. This must be done after self._grpc_channel exists + self._interceptor = _LoggingClientInterceptor() + self._logged_channel = grpc.intercept_channel( + self._grpc_channel, self._interceptor + ) + + # Wrap messages. This must be done after self._logged_channel exists self._prep_wrapped_messages(client_info) @classmethod @@ -257,7 +343,7 @@ def list_image_versions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_image_versions" not in self._stubs: - self._stubs["list_image_versions"] = self.grpc_channel.unary_unary( + self._stubs["list_image_versions"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.ImageVersions/ListImageVersions", request_serializer=image_versions.ListImageVersionsRequest.serialize, response_deserializer=image_versions.ListImageVersionsResponse.deserialize, @@ -265,7 +351,7 @@ def list_image_versions( return self._stubs["list_image_versions"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -277,7 +363,7 @@ def delete_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + self._stubs["delete_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/DeleteOperation", request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, response_deserializer=None, @@ -294,7 +380,7 @@ def get_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( + self._stubs["get_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/GetOperation", request_serializer=operations_pb2.GetOperationRequest.SerializeToString, response_deserializer=operations_pb2.Operation.FromString, @@ -313,7 +399,7 @@ def list_operations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( + self._stubs["list_operations"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/ListOperations", request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, response_deserializer=operations_pb2.ListOperationsResponse.FromString, diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/grpc_asyncio.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/grpc_asyncio.py index 99288a480590..20ac65618806 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/grpc_asyncio.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import logging as std_logging +import pickle from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union import warnings @@ -23,14 +26,93 @@ from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.longrunning import operations_pb2 # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore from grpc.experimental import aio # type: ignore +import proto # type: ignore from google.cloud.orchestration.airflow.service_v1beta1.types import image_versions from .base import DEFAULT_CLIENT_INFO, ImageVersionsTransport from .grpc import ImageVersionsGrpcTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientAIOInterceptor( + grpc.aio.UnaryUnaryClientInterceptor +): # pragma: NO COVER + async def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "rpcName": str(client_call_details.method), + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + response = await continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = await response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = ( + dict([(k, str(v)) for k, v in response_metadata]) + if response_metadata + else None + ) + result = await response + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response to rpc {client_call_details.method}.", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ImageVersionsGrpcAsyncIOTransport(ImageVersionsTransport): """gRPC AsyncIO backend transport for ImageVersions. @@ -227,10 +309,13 @@ def __init__( ], ) - # Wrap messages. This must be done after self._grpc_channel exists + self._interceptor = _LoggingClientAIOInterceptor() + self._grpc_channel._unary_unary_interceptors.append(self._interceptor) + self._logged_channel = self._grpc_channel self._wrap_with_kind = ( "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters ) + # Wrap messages. This must be done after self._logged_channel exists self._prep_wrapped_messages(client_info) @property @@ -265,7 +350,7 @@ def list_image_versions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_image_versions" not in self._stubs: - self._stubs["list_image_versions"] = self.grpc_channel.unary_unary( + self._stubs["list_image_versions"] = self._logged_channel.unary_unary( "/google.cloud.orchestration.airflow.service.v1beta1.ImageVersions/ListImageVersions", request_serializer=image_versions.ListImageVersionsRequest.serialize, response_deserializer=image_versions.ListImageVersionsResponse.deserialize, @@ -303,7 +388,7 @@ def _wrap_method(self, func, *args, **kwargs): return gapic_v1.method_async.wrap_method(func, *args, **kwargs) def close(self): - return self.grpc_channel.close() + return self._logged_channel.close() @property def kind(self) -> str: @@ -319,7 +404,7 @@ def delete_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + self._stubs["delete_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/DeleteOperation", request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, response_deserializer=None, @@ -336,7 +421,7 @@ def get_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( + self._stubs["get_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/GetOperation", request_serializer=operations_pb2.GetOperationRequest.SerializeToString, response_deserializer=operations_pb2.Operation.FromString, @@ -355,7 +440,7 @@ def list_operations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( + self._stubs["list_operations"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/ListOperations", request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, response_deserializer=operations_pb2.ListOperationsResponse.FromString, diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/rest.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/rest.py index 9c3cabd25624..f8048b38bdb2 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/rest.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/rest.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import dataclasses import json # type: ignore +import logging from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings @@ -38,6 +38,14 @@ except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = logging.getLogger(__name__) DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, @@ -78,8 +86,10 @@ def post_list_image_versions(self, response): def pre_list_image_versions( self, request: image_versions.ListImageVersionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[image_versions.ListImageVersionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + image_versions.ListImageVersionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_image_versions Override in a subclass to manipulate the request or metadata @@ -101,8 +111,10 @@ def post_list_image_versions( def pre_delete_operation( self, request: operations_pb2.DeleteOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_operation Override in a subclass to manipulate the request or metadata @@ -122,8 +134,10 @@ def post_delete_operation(self, response: None) -> None: def pre_get_operation( self, request: operations_pb2.GetOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.GetOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_operation Override in a subclass to manipulate the request or metadata @@ -145,8 +159,10 @@ def post_get_operation( def pre_list_operations( self, request: operations_pb2.ListOperationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.ListOperationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_operations Override in a subclass to manipulate the request or metadata @@ -286,7 +302,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> image_versions.ListImageVersionsResponse: r"""Call the list image versions method over HTTP. @@ -297,8 +313,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.image_versions.ListImageVersionsResponse: @@ -310,6 +328,7 @@ def __call__( http_options = ( _BaseImageVersionsRestTransport._BaseListImageVersions._get_http_options() ) + request, metadata = self._interceptor.pre_list_image_versions( request, metadata ) @@ -322,6 +341,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.ImageVersionsClient.ListImageVersions", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "rpcName": "ListImageVersions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ImageVersionsRestTransport._ListImageVersions._get_response( self._host, @@ -342,7 +388,31 @@ def __call__( pb_resp = image_versions.ListImageVersionsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_image_versions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = image_versions.ListImageVersionsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.ImageVersionsClient.list_image_versions", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "rpcName": "ListImageVersions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -394,7 +464,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Call the delete operation method over HTTP. @@ -404,13 +474,16 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ http_options = ( _BaseImageVersionsRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -423,6 +496,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.ImageVersionsClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ImageVersionsRestTransport._DeleteOperation._get_response( self._host, @@ -478,7 +578,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.Operation: r"""Call the get operation method over HTTP. @@ -488,8 +588,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: operations_pb2.Operation: Response from GetOperation method. @@ -498,6 +600,7 @@ def __call__( http_options = ( _BaseImageVersionsRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseImageVersionsRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -508,6 +611,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.ImageVersionsClient.GetOperation", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ImageVersionsRestTransport._GetOperation._get_response( self._host, @@ -527,6 +657,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_operation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.ImageVersionsAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -567,7 +718,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Call the list operations method over HTTP. @@ -577,8 +728,10 @@ def __call__( 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. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: operations_pb2.ListOperationsResponse: Response from ListOperations method. @@ -587,6 +740,7 @@ def __call__( http_options = ( _BaseImageVersionsRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseImageVersionsRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -597,6 +751,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.cloud.orchestration.airflow.service_v1beta1.ImageVersionsClient.ListOperations", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ImageVersionsRestTransport._ListOperations._get_response( self._host, @@ -616,6 +797,27 @@ def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_operations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = json_format.MessageToJson(resp) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.cloud.orchestration.airflow.service_v1beta1.ImageVersionsAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.orchestration.airflow.service.v1beta1.ImageVersions", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/types/environments.py b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/types/environments.py index a7d029a3a945..9ec1b54524ac 100644 --- a/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/types/environments.py +++ b/packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/types/environments.py @@ -915,6 +915,13 @@ class UserWorkloadsSecret(proto.Message): token, or a key. The values for all keys have to be base64-encoded strings. For details see: https://kubernetes.io/docs/concepts/configuration/secret/ + + Example: + + { + "example": "ZXhhbXBsZV92YWx1ZQ==", + "another-example": + "YW5vdGhlcl9leGFtcGxlX3ZhbHVl" } """ name: str = proto.Field( @@ -967,11 +974,14 @@ class UserWorkloadsConfigMap(proto.Message): ConfigMap, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}". data (MutableMapping[str, str]): - Optional. The "data" field of Kubernetes - ConfigMap, organized in key-value pairs. For - details see: - + Optional. The "data" field of Kubernetes ConfigMap, + organized in key-value pairs. For details see: https://kubernetes.io/docs/concepts/configuration/configmap/ + + Example: + + { "example_key": "example_value", "another_key": + "another_value" } """ name: str = proto.Field( @@ -1389,14 +1399,14 @@ class EnvironmentConfig(proto.Message): This field is supported for Cloud Composer environments in versions composer-1.\ *.*-airflow-*.*.*. software_config (google.cloud.orchestration.airflow.service_v1beta1.types.SoftwareConfig): - The configuration settings for software - inside the environment. + Optional. The configuration settings for + software inside the environment. node_config (google.cloud.orchestration.airflow.service_v1beta1.types.NodeConfig): - The configuration used for the Kubernetes - Engine cluster. + Optional. The configuration used for the + Kubernetes Engine cluster. private_environment_config (google.cloud.orchestration.airflow.service_v1beta1.types.PrivateEnvironmentConfig): - The configuration used for the Private IP - Cloud Composer environment. + Optional. The configuration used for the + Private IP Cloud Composer environment. web_server_network_access_control (google.cloud.orchestration.airflow.service_v1beta1.types.WebServerNetworkAccessControl): Optional. The network-level access control policy for the Airflow web server. If @@ -1661,10 +1671,10 @@ class SoftwareConfig(proto.Message): Attributes: image_version (str): - The version of the software running in the environment. This - encapsulates both the version of Cloud Composer - functionality and the version of Apache Airflow. It must - match the regular expression + Optional. The version of the software running in the + environment. This encapsulates both the version of Cloud + Composer functionality and the version of Apache Airflow. It + must match the regular expression ``composer-([0-9]+(\.[0-9]+\.[0-9]+(-preview\.[0-9]+)?)?|latest)-airflow-([0-9]+(\.[0-9]+(\.[0-9]+)?)?)``. When used as input, the server also checks if the provided version is supported and denies the request for an @@ -2920,15 +2930,15 @@ class Environment(proto.Message): Attributes: name (str): - The resource name of the environment, in the - form: + Identifier. The resource name of the + environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}" EnvironmentId must start with a lowercase letter followed by up to 63 lowercase letters, numbers, or hyphens, and cannot end with a hyphen. config (google.cloud.orchestration.airflow.service_v1beta1.types.EnvironmentConfig): - Configuration parameters for this + Optional. Configuration parameters for this environment. uuid (str): Output only. The UUID (Universally Unique diff --git a/packages/google-cloud-orchestration-airflow/samples/generated_samples/snippet_metadata_google.cloud.orchestration.airflow.service.v1.json b/packages/google-cloud-orchestration-airflow/samples/generated_samples/snippet_metadata_google.cloud.orchestration.airflow.service.v1.json index 39f21143bdf4..37f3c1f31434 100644 --- a/packages/google-cloud-orchestration-airflow/samples/generated_samples/snippet_metadata_google.cloud.orchestration.airflow.service.v1.json +++ b/packages/google-cloud-orchestration-airflow/samples/generated_samples/snippet_metadata_google.cloud.orchestration.airflow.service.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-orchestration-airflow", - "version": "1.15.1" + "version": "0.1.0" }, "snippets": [ { @@ -43,7 +43,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -119,7 +119,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -204,7 +204,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -288,7 +288,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -373,7 +373,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsConfigMap", @@ -457,7 +457,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsConfigMap", @@ -542,7 +542,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsSecret", @@ -626,7 +626,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsSecret", @@ -703,7 +703,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -779,7 +779,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -860,7 +860,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -940,7 +940,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -1021,7 +1021,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_user_workloads_config_map" @@ -1098,7 +1098,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_user_workloads_config_map" @@ -1176,7 +1176,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_user_workloads_secret" @@ -1253,7 +1253,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_user_workloads_secret" @@ -1327,7 +1327,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.ExecuteAirflowCommandResponse", @@ -1403,7 +1403,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.ExecuteAirflowCommandResponse", @@ -1480,7 +1480,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.FetchDatabasePropertiesResponse", @@ -1556,7 +1556,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.FetchDatabasePropertiesResponse", @@ -1637,7 +1637,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.Environment", @@ -1717,7 +1717,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.Environment", @@ -1798,7 +1798,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsConfigMap", @@ -1878,7 +1878,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsConfigMap", @@ -1959,7 +1959,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsSecret", @@ -2039,7 +2039,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsSecret", @@ -2120,7 +2120,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListEnvironmentsAsyncPager", @@ -2200,7 +2200,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListEnvironmentsPager", @@ -2281,7 +2281,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListUserWorkloadsConfigMapsAsyncPager", @@ -2361,7 +2361,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListUserWorkloadsConfigMapsPager", @@ -2442,7 +2442,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListUserWorkloadsSecretsAsyncPager", @@ -2522,7 +2522,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListUserWorkloadsSecretsPager", @@ -2603,7 +2603,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListWorkloadsAsyncPager", @@ -2683,7 +2683,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.services.environments.pagers.ListWorkloadsPager", @@ -2760,7 +2760,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -2836,7 +2836,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -2913,7 +2913,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.PollAirflowCommandResponse", @@ -2989,7 +2989,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.PollAirflowCommandResponse", @@ -3066,7 +3066,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -3142,7 +3142,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -3219,7 +3219,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.StopAirflowCommandResponse", @@ -3295,7 +3295,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.StopAirflowCommandResponse", @@ -3384,7 +3384,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -3472,7 +3472,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -3553,7 +3553,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsConfigMap", @@ -3633,7 +3633,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsConfigMap", @@ -3714,7 +3714,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsSecret", @@ -3794,7 +3794,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.types.UserWorkloadsSecret", @@ -3875,7 +3875,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.services.image_versions.pagers.ListImageVersionsAsyncPager", @@ -3955,7 +3955,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1.services.image_versions.pagers.ListImageVersionsPager", diff --git a/packages/google-cloud-orchestration-airflow/samples/generated_samples/snippet_metadata_google.cloud.orchestration.airflow.service.v1beta1.json b/packages/google-cloud-orchestration-airflow/samples/generated_samples/snippet_metadata_google.cloud.orchestration.airflow.service.v1beta1.json index 67179ecd614e..5dde9a47fdfc 100644 --- a/packages/google-cloud-orchestration-airflow/samples/generated_samples/snippet_metadata_google.cloud.orchestration.airflow.service.v1beta1.json +++ b/packages/google-cloud-orchestration-airflow/samples/generated_samples/snippet_metadata_google.cloud.orchestration.airflow.service.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-orchestration-airflow-service", - "version": "1.15.1" + "version": "0.1.0" }, "snippets": [ { @@ -43,7 +43,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -119,7 +119,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -204,7 +204,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -288,7 +288,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -373,7 +373,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsConfigMap", @@ -457,7 +457,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsConfigMap", @@ -542,7 +542,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsSecret", @@ -626,7 +626,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsSecret", @@ -703,7 +703,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -779,7 +779,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -860,7 +860,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -940,7 +940,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -1021,7 +1021,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_user_workloads_config_map" @@ -1098,7 +1098,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_user_workloads_config_map" @@ -1176,7 +1176,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_user_workloads_secret" @@ -1253,7 +1253,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_user_workloads_secret" @@ -1327,7 +1327,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.ExecuteAirflowCommandResponse", @@ -1403,7 +1403,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.ExecuteAirflowCommandResponse", @@ -1480,7 +1480,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.FetchDatabasePropertiesResponse", @@ -1556,7 +1556,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.FetchDatabasePropertiesResponse", @@ -1637,7 +1637,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.Environment", @@ -1717,7 +1717,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.Environment", @@ -1798,7 +1798,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsConfigMap", @@ -1878,7 +1878,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsConfigMap", @@ -1959,7 +1959,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsSecret", @@ -2039,7 +2039,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsSecret", @@ -2120,7 +2120,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListEnvironmentsAsyncPager", @@ -2200,7 +2200,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListEnvironmentsPager", @@ -2281,7 +2281,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListUserWorkloadsConfigMapsAsyncPager", @@ -2361,7 +2361,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListUserWorkloadsConfigMapsPager", @@ -2442,7 +2442,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListUserWorkloadsSecretsAsyncPager", @@ -2522,7 +2522,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListUserWorkloadsSecretsPager", @@ -2603,7 +2603,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListWorkloadsAsyncPager", @@ -2683,7 +2683,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.services.environments.pagers.ListWorkloadsPager", @@ -2760,7 +2760,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -2836,7 +2836,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -2913,7 +2913,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.PollAirflowCommandResponse", @@ -2989,7 +2989,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.PollAirflowCommandResponse", @@ -3066,7 +3066,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -3142,7 +3142,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -3219,7 +3219,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -3295,7 +3295,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -3372,7 +3372,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.StopAirflowCommandResponse", @@ -3448,7 +3448,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.StopAirflowCommandResponse", @@ -3537,7 +3537,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -3625,7 +3625,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -3706,7 +3706,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsConfigMap", @@ -3786,7 +3786,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsConfigMap", @@ -3867,7 +3867,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsSecret", @@ -3947,7 +3947,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.types.UserWorkloadsSecret", @@ -4028,7 +4028,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.services.image_versions.pagers.ListImageVersionsAsyncPager", @@ -4108,7 +4108,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.orchestration.airflow.service_v1beta1.services.image_versions.pagers.ListImageVersionsPager", diff --git a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_environments.py b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_environments.py index faf173901c01..9591f6ae290d 100644 --- a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_environments.py +++ b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_environments.py @@ -9505,6 +9505,7 @@ def test_create_environment_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_environment(**mock_args) @@ -9601,6 +9602,7 @@ def test_get_environment_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_environment(**mock_args) @@ -9696,6 +9698,7 @@ def test_list_environments_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_environments(**mock_args) @@ -9862,6 +9865,7 @@ def test_update_environment_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_environment(**mock_args) @@ -9965,6 +9969,7 @@ def test_delete_environment_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_environment(**mock_args) @@ -10225,6 +10230,7 @@ def test_list_workloads_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_workloads(request) @@ -10281,6 +10287,7 @@ def test_list_workloads_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_workloads(**mock_args) @@ -10482,6 +10489,7 @@ def test_check_upgrade_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.check_upgrade(request) @@ -10607,6 +10615,7 @@ def test_create_user_workloads_secret_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_user_workloads_secret(request) @@ -10663,6 +10672,7 @@ def test_create_user_workloads_secret_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_user_workloads_secret(**mock_args) @@ -10800,6 +10810,7 @@ def test_get_user_workloads_secret_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_user_workloads_secret(request) @@ -10847,6 +10858,7 @@ def test_get_user_workloads_secret_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_user_workloads_secret(**mock_args) @@ -10992,6 +11004,7 @@ def test_list_user_workloads_secrets_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_user_workloads_secrets(request) @@ -11047,6 +11060,7 @@ def test_list_user_workloads_secrets_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_user_workloads_secrets(**mock_args) @@ -11214,6 +11228,7 @@ def test_update_user_workloads_secret_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_user_workloads_secret(**mock_args) @@ -11347,6 +11362,7 @@ def test_delete_user_workloads_secret_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_user_workloads_secret(request) @@ -11392,6 +11408,7 @@ def test_delete_user_workloads_secret_rest_flattened(): json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_user_workloads_secret(**mock_args) @@ -11529,6 +11546,7 @@ def test_create_user_workloads_config_map_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_user_workloads_config_map(request) @@ -11589,6 +11607,7 @@ def test_create_user_workloads_config_map_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_user_workloads_config_map(**mock_args) @@ -11728,6 +11747,7 @@ def test_get_user_workloads_config_map_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_user_workloads_config_map(request) @@ -11777,6 +11797,7 @@ def test_get_user_workloads_config_map_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_user_workloads_config_map(**mock_args) @@ -11922,6 +11943,7 @@ def test_list_user_workloads_config_maps_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_user_workloads_config_maps(request) @@ -11979,6 +12001,7 @@ def test_list_user_workloads_config_maps_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_user_workloads_config_maps(**mock_args) @@ -12151,6 +12174,7 @@ def test_update_user_workloads_config_map_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_user_workloads_config_map(**mock_args) @@ -12286,6 +12310,7 @@ def test_delete_user_workloads_config_map_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_user_workloads_config_map(request) @@ -12333,6 +12358,7 @@ def test_delete_user_workloads_config_map_rest_flattened(): json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_user_workloads_config_map(**mock_args) @@ -12591,6 +12617,7 @@ def test_fetch_database_properties_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.fetch_database_properties(request) @@ -13972,6 +13999,7 @@ def test_create_environment_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_environment(request) @@ -14199,6 +14227,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_environment(request) # Establish that the response is the type that we expect. @@ -14240,6 +14269,7 @@ def test_create_environment_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -14284,6 +14314,7 @@ def test_get_environment_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_environment(request) @@ -14323,6 +14354,7 @@ def test_get_environment_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_environment(request) # Establish that the response is the type that we expect. @@ -14367,6 +14399,7 @@ def test_get_environment_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.Environment.to_json(environments.Environment()) req.return_value.content = return_value @@ -14411,6 +14444,7 @@ def test_list_environments_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_environments(request) @@ -14446,6 +14480,7 @@ def test_list_environments_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_environments(request) # Establish that the response is the type that we expect. @@ -14486,6 +14521,7 @@ def test_list_environments_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.ListEnvironmentsResponse.to_json( environments.ListEnvironmentsResponse() ) @@ -14532,6 +14568,7 @@ def test_update_environment_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_environment(request) @@ -14759,6 +14796,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_environment(request) # Establish that the response is the type that we expect. @@ -14800,6 +14838,7 @@ def test_update_environment_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -14844,6 +14883,7 @@ def test_delete_environment_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_environment(request) @@ -14874,6 +14914,7 @@ def test_delete_environment_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_environment(request) # Establish that the response is the type that we expect. @@ -14915,6 +14956,7 @@ def test_delete_environment_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -14961,6 +15003,7 @@ def test_execute_airflow_command_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.execute_airflow_command(request) @@ -15001,6 +15044,7 @@ def test_execute_airflow_command_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.execute_airflow_command(request) # Establish that the response is the type that we expect. @@ -15044,6 +15088,7 @@ def test_execute_airflow_command_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.ExecuteAirflowCommandResponse.to_json( environments.ExecuteAirflowCommandResponse() ) @@ -15092,6 +15137,7 @@ def test_stop_airflow_command_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.stop_airflow_command(request) @@ -15130,6 +15176,7 @@ def test_stop_airflow_command_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.stop_airflow_command(request) # Establish that the response is the type that we expect. @@ -15171,6 +15218,7 @@ def test_stop_airflow_command_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.StopAirflowCommandResponse.to_json( environments.StopAirflowCommandResponse() ) @@ -15219,6 +15267,7 @@ def test_poll_airflow_command_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.poll_airflow_command(request) @@ -15256,6 +15305,7 @@ def test_poll_airflow_command_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.poll_airflow_command(request) # Establish that the response is the type that we expect. @@ -15296,6 +15346,7 @@ def test_poll_airflow_command_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.PollAirflowCommandResponse.to_json( environments.PollAirflowCommandResponse() ) @@ -15342,6 +15393,7 @@ def test_list_workloads_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_workloads(request) @@ -15377,6 +15429,7 @@ def test_list_workloads_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_workloads(request) # Establish that the response is the type that we expect. @@ -15417,6 +15470,7 @@ def test_list_workloads_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.ListWorkloadsResponse.to_json( environments.ListWorkloadsResponse() ) @@ -15463,6 +15517,7 @@ def test_check_upgrade_rest_bad_request(request_type=environments.CheckUpgradeRe response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.check_upgrade(request) @@ -15495,6 +15550,7 @@ def test_check_upgrade_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.check_upgrade(request) # Establish that the response is the type that we expect. @@ -15536,6 +15592,7 @@ def test_check_upgrade_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -15580,6 +15637,7 @@ def test_create_user_workloads_secret_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_user_workloads_secret(request) @@ -15687,6 +15745,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_user_workloads_secret(request) # Establish that the response is the type that we expect. @@ -15727,6 +15786,7 @@ def test_create_user_workloads_secret_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.UserWorkloadsSecret.to_json( environments.UserWorkloadsSecret() ) @@ -15775,6 +15835,7 @@ def test_get_user_workloads_secret_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_user_workloads_secret(request) @@ -15812,6 +15873,7 @@ def test_get_user_workloads_secret_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_user_workloads_secret(request) # Establish that the response is the type that we expect. @@ -15852,6 +15914,7 @@ def test_get_user_workloads_secret_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.UserWorkloadsSecret.to_json( environments.UserWorkloadsSecret() ) @@ -15898,6 +15961,7 @@ def test_list_user_workloads_secrets_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_user_workloads_secrets(request) @@ -15933,6 +15997,7 @@ def test_list_user_workloads_secrets_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_user_workloads_secrets(request) # Establish that the response is the type that we expect. @@ -15973,6 +16038,7 @@ def test_list_user_workloads_secrets_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.ListUserWorkloadsSecretsResponse.to_json( environments.ListUserWorkloadsSecretsResponse() ) @@ -16023,6 +16089,7 @@ def test_update_user_workloads_secret_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_user_workloads_secret(request) @@ -16137,6 +16204,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_user_workloads_secret(request) # Establish that the response is the type that we expect. @@ -16177,6 +16245,7 @@ def test_update_user_workloads_secret_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.UserWorkloadsSecret.to_json( environments.UserWorkloadsSecret() ) @@ -16225,6 +16294,7 @@ def test_delete_user_workloads_secret_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_user_workloads_secret(request) @@ -16257,6 +16327,7 @@ def test_delete_user_workloads_secret_rest_call_success(request_type): json_return_value = "" response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_user_workloads_secret(request) # Establish that the response is the type that we expect. @@ -16293,6 +16364,7 @@ def test_delete_user_workloads_secret_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = environments.DeleteUserWorkloadsSecretRequest() metadata = [ @@ -16333,6 +16405,7 @@ def test_create_user_workloads_config_map_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_user_workloads_config_map(request) @@ -16442,6 +16515,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_user_workloads_config_map(request) # Establish that the response is the type that we expect. @@ -16482,6 +16556,7 @@ def test_create_user_workloads_config_map_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.UserWorkloadsConfigMap.to_json( environments.UserWorkloadsConfigMap() ) @@ -16530,6 +16605,7 @@ def test_get_user_workloads_config_map_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_user_workloads_config_map(request) @@ -16567,6 +16643,7 @@ def test_get_user_workloads_config_map_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_user_workloads_config_map(request) # Establish that the response is the type that we expect. @@ -16607,6 +16684,7 @@ def test_get_user_workloads_config_map_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.UserWorkloadsConfigMap.to_json( environments.UserWorkloadsConfigMap() ) @@ -16653,6 +16731,7 @@ def test_list_user_workloads_config_maps_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_user_workloads_config_maps(request) @@ -16688,6 +16767,7 @@ def test_list_user_workloads_config_maps_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_user_workloads_config_maps(request) # Establish that the response is the type that we expect. @@ -16728,6 +16808,7 @@ def test_list_user_workloads_config_maps_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.ListUserWorkloadsConfigMapsResponse.to_json( environments.ListUserWorkloadsConfigMapsResponse() ) @@ -16778,6 +16859,7 @@ def test_update_user_workloads_config_map_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_user_workloads_config_map(request) @@ -16894,6 +16976,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_user_workloads_config_map(request) # Establish that the response is the type that we expect. @@ -16934,6 +17017,7 @@ def test_update_user_workloads_config_map_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.UserWorkloadsConfigMap.to_json( environments.UserWorkloadsConfigMap() ) @@ -16982,6 +17066,7 @@ def test_delete_user_workloads_config_map_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_user_workloads_config_map(request) @@ -17014,6 +17099,7 @@ def test_delete_user_workloads_config_map_rest_call_success(request_type): json_return_value = "" response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_user_workloads_config_map(request) # Establish that the response is the type that we expect. @@ -17050,6 +17136,7 @@ def test_delete_user_workloads_config_map_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = environments.DeleteUserWorkloadsConfigMapRequest() metadata = [ @@ -17090,6 +17177,7 @@ def test_save_snapshot_rest_bad_request(request_type=environments.SaveSnapshotRe response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.save_snapshot(request) @@ -17122,6 +17210,7 @@ def test_save_snapshot_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.save_snapshot(request) # Establish that the response is the type that we expect. @@ -17163,6 +17252,7 @@ def test_save_snapshot_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -17207,6 +17297,7 @@ def test_load_snapshot_rest_bad_request(request_type=environments.LoadSnapshotRe response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.load_snapshot(request) @@ -17239,6 +17330,7 @@ def test_load_snapshot_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.load_snapshot(request) # Establish that the response is the type that we expect. @@ -17280,6 +17372,7 @@ def test_load_snapshot_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -17326,6 +17419,7 @@ def test_database_failover_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.database_failover(request) @@ -17358,6 +17452,7 @@ def test_database_failover_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.database_failover(request) # Establish that the response is the type that we expect. @@ -17399,6 +17494,7 @@ def test_database_failover_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -17445,6 +17541,7 @@ def test_fetch_database_properties_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.fetch_database_properties(request) @@ -17484,6 +17581,7 @@ def test_fetch_database_properties_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.fetch_database_properties(request) # Establish that the response is the type that we expect. @@ -17526,6 +17624,7 @@ def test_fetch_database_properties_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.FetchDatabasePropertiesResponse.to_json( environments.FetchDatabasePropertiesResponse() ) @@ -17574,6 +17673,7 @@ def test_delete_operation_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_operation(request) @@ -17604,6 +17704,7 @@ def test_delete_operation_rest(request_type): response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_operation(request) @@ -17634,6 +17735,7 @@ def test_get_operation_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_operation(request) @@ -17664,6 +17766,7 @@ def test_get_operation_rest(request_type): response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_operation(request) @@ -17694,6 +17797,7 @@ def test_list_operations_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_operations(request) @@ -17724,6 +17828,7 @@ def test_list_operations_rest(request_type): response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_operations(request) diff --git a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_image_versions.py b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_image_versions.py index 3b558940d7bd..f08412322564 100644 --- a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_image_versions.py +++ b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_image_versions.py @@ -1671,6 +1671,7 @@ def test_list_image_versions_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_image_versions(**mock_args) @@ -1963,6 +1964,7 @@ def test_list_image_versions_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_image_versions(request) @@ -1998,6 +2000,7 @@ def test_list_image_versions_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_image_versions(request) # Establish that the response is the type that we expect. @@ -2038,6 +2041,7 @@ def test_list_image_versions_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = image_versions.ListImageVersionsResponse.to_json( image_versions.ListImageVersionsResponse() ) @@ -2086,6 +2090,7 @@ def test_delete_operation_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_operation(request) @@ -2116,6 +2121,7 @@ def test_delete_operation_rest(request_type): response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_operation(request) @@ -2146,6 +2152,7 @@ def test_get_operation_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_operation(request) @@ -2176,6 +2183,7 @@ def test_get_operation_rest(request_type): response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_operation(request) @@ -2206,6 +2214,7 @@ def test_list_operations_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_operations(request) @@ -2236,6 +2245,7 @@ def test_list_operations_rest(request_type): response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_operations(request) diff --git a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_environments.py b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_environments.py index 42b085dc030a..bbbb1b5bc782 100644 --- a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_environments.py +++ b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_environments.py @@ -9767,6 +9767,7 @@ def test_create_environment_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_environment(**mock_args) @@ -9863,6 +9864,7 @@ def test_get_environment_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_environment(**mock_args) @@ -9958,6 +9960,7 @@ def test_list_environments_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_environments(**mock_args) @@ -10155,6 +10158,7 @@ def test_update_environment_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_environment(request) @@ -10202,6 +10206,7 @@ def test_update_environment_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_environment(**mock_args) @@ -10305,6 +10310,7 @@ def test_delete_environment_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_environment(**mock_args) @@ -10649,6 +10655,7 @@ def test_list_workloads_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_workloads(request) @@ -10705,6 +10712,7 @@ def test_list_workloads_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_workloads(**mock_args) @@ -10910,6 +10918,7 @@ def test_create_user_workloads_secret_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_user_workloads_secret(request) @@ -10966,6 +10975,7 @@ def test_create_user_workloads_secret_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_user_workloads_secret(**mock_args) @@ -11103,6 +11113,7 @@ def test_get_user_workloads_secret_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_user_workloads_secret(request) @@ -11150,6 +11161,7 @@ def test_get_user_workloads_secret_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_user_workloads_secret(**mock_args) @@ -11295,6 +11307,7 @@ def test_list_user_workloads_secrets_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_user_workloads_secrets(request) @@ -11350,6 +11363,7 @@ def test_list_user_workloads_secrets_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_user_workloads_secrets(**mock_args) @@ -11517,6 +11531,7 @@ def test_update_user_workloads_secret_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_user_workloads_secret(**mock_args) @@ -11650,6 +11665,7 @@ def test_delete_user_workloads_secret_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_user_workloads_secret(request) @@ -11695,6 +11711,7 @@ def test_delete_user_workloads_secret_rest_flattened(): json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_user_workloads_secret(**mock_args) @@ -11832,6 +11849,7 @@ def test_create_user_workloads_config_map_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_user_workloads_config_map(request) @@ -11892,6 +11910,7 @@ def test_create_user_workloads_config_map_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_user_workloads_config_map(**mock_args) @@ -12031,6 +12050,7 @@ def test_get_user_workloads_config_map_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_user_workloads_config_map(request) @@ -12080,6 +12100,7 @@ def test_get_user_workloads_config_map_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_user_workloads_config_map(**mock_args) @@ -12225,6 +12246,7 @@ def test_list_user_workloads_config_maps_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_user_workloads_config_maps(request) @@ -12282,6 +12304,7 @@ def test_list_user_workloads_config_maps_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_user_workloads_config_maps(**mock_args) @@ -12454,6 +12477,7 @@ def test_update_user_workloads_config_map_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_user_workloads_config_map(**mock_args) @@ -12589,6 +12613,7 @@ def test_delete_user_workloads_config_map_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_user_workloads_config_map(request) @@ -12636,6 +12661,7 @@ def test_delete_user_workloads_config_map_rest_flattened(): json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_user_workloads_config_map(**mock_args) @@ -12894,6 +12920,7 @@ def test_fetch_database_properties_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.fetch_database_properties(request) @@ -14325,6 +14352,7 @@ def test_create_environment_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_environment(request) @@ -14554,6 +14582,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_environment(request) # Establish that the response is the type that we expect. @@ -14595,6 +14624,7 @@ def test_create_environment_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -14639,6 +14669,7 @@ def test_get_environment_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_environment(request) @@ -14678,6 +14709,7 @@ def test_get_environment_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_environment(request) # Establish that the response is the type that we expect. @@ -14722,6 +14754,7 @@ def test_get_environment_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.Environment.to_json(environments.Environment()) req.return_value.content = return_value @@ -14766,6 +14799,7 @@ def test_list_environments_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_environments(request) @@ -14801,6 +14835,7 @@ def test_list_environments_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_environments(request) # Establish that the response is the type that we expect. @@ -14841,6 +14876,7 @@ def test_list_environments_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.ListEnvironmentsResponse.to_json( environments.ListEnvironmentsResponse() ) @@ -14887,6 +14923,7 @@ def test_update_environment_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_environment(request) @@ -15116,6 +15153,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_environment(request) # Establish that the response is the type that we expect. @@ -15157,6 +15195,7 @@ def test_update_environment_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -15201,6 +15240,7 @@ def test_delete_environment_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_environment(request) @@ -15231,6 +15271,7 @@ def test_delete_environment_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_environment(request) # Establish that the response is the type that we expect. @@ -15272,6 +15313,7 @@ def test_delete_environment_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -15316,6 +15358,7 @@ def test_restart_web_server_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.restart_web_server(request) @@ -15346,6 +15389,7 @@ def test_restart_web_server_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.restart_web_server(request) # Establish that the response is the type that we expect. @@ -15387,6 +15431,7 @@ def test_restart_web_server_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -15431,6 +15476,7 @@ def test_check_upgrade_rest_bad_request(request_type=environments.CheckUpgradeRe response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.check_upgrade(request) @@ -15463,6 +15509,7 @@ def test_check_upgrade_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.check_upgrade(request) # Establish that the response is the type that we expect. @@ -15504,6 +15551,7 @@ def test_check_upgrade_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -15550,6 +15598,7 @@ def test_execute_airflow_command_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.execute_airflow_command(request) @@ -15590,6 +15639,7 @@ def test_execute_airflow_command_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.execute_airflow_command(request) # Establish that the response is the type that we expect. @@ -15633,6 +15683,7 @@ def test_execute_airflow_command_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.ExecuteAirflowCommandResponse.to_json( environments.ExecuteAirflowCommandResponse() ) @@ -15681,6 +15732,7 @@ def test_stop_airflow_command_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.stop_airflow_command(request) @@ -15719,6 +15771,7 @@ def test_stop_airflow_command_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.stop_airflow_command(request) # Establish that the response is the type that we expect. @@ -15760,6 +15813,7 @@ def test_stop_airflow_command_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.StopAirflowCommandResponse.to_json( environments.StopAirflowCommandResponse() ) @@ -15808,6 +15862,7 @@ def test_poll_airflow_command_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.poll_airflow_command(request) @@ -15845,6 +15900,7 @@ def test_poll_airflow_command_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.poll_airflow_command(request) # Establish that the response is the type that we expect. @@ -15885,6 +15941,7 @@ def test_poll_airflow_command_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.PollAirflowCommandResponse.to_json( environments.PollAirflowCommandResponse() ) @@ -15931,6 +15988,7 @@ def test_list_workloads_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_workloads(request) @@ -15966,6 +16024,7 @@ def test_list_workloads_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_workloads(request) # Establish that the response is the type that we expect. @@ -16006,6 +16065,7 @@ def test_list_workloads_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.ListWorkloadsResponse.to_json( environments.ListWorkloadsResponse() ) @@ -16052,6 +16112,7 @@ def test_create_user_workloads_secret_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_user_workloads_secret(request) @@ -16159,6 +16220,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_user_workloads_secret(request) # Establish that the response is the type that we expect. @@ -16199,6 +16261,7 @@ def test_create_user_workloads_secret_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.UserWorkloadsSecret.to_json( environments.UserWorkloadsSecret() ) @@ -16247,6 +16310,7 @@ def test_get_user_workloads_secret_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_user_workloads_secret(request) @@ -16284,6 +16348,7 @@ def test_get_user_workloads_secret_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_user_workloads_secret(request) # Establish that the response is the type that we expect. @@ -16324,6 +16389,7 @@ def test_get_user_workloads_secret_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.UserWorkloadsSecret.to_json( environments.UserWorkloadsSecret() ) @@ -16370,6 +16436,7 @@ def test_list_user_workloads_secrets_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_user_workloads_secrets(request) @@ -16405,6 +16472,7 @@ def test_list_user_workloads_secrets_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_user_workloads_secrets(request) # Establish that the response is the type that we expect. @@ -16445,6 +16513,7 @@ def test_list_user_workloads_secrets_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.ListUserWorkloadsSecretsResponse.to_json( environments.ListUserWorkloadsSecretsResponse() ) @@ -16495,6 +16564,7 @@ def test_update_user_workloads_secret_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_user_workloads_secret(request) @@ -16609,6 +16679,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_user_workloads_secret(request) # Establish that the response is the type that we expect. @@ -16649,6 +16720,7 @@ def test_update_user_workloads_secret_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.UserWorkloadsSecret.to_json( environments.UserWorkloadsSecret() ) @@ -16697,6 +16769,7 @@ def test_delete_user_workloads_secret_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_user_workloads_secret(request) @@ -16729,6 +16802,7 @@ def test_delete_user_workloads_secret_rest_call_success(request_type): json_return_value = "" response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_user_workloads_secret(request) # Establish that the response is the type that we expect. @@ -16765,6 +16839,7 @@ def test_delete_user_workloads_secret_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = environments.DeleteUserWorkloadsSecretRequest() metadata = [ @@ -16805,6 +16880,7 @@ def test_create_user_workloads_config_map_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_user_workloads_config_map(request) @@ -16914,6 +16990,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_user_workloads_config_map(request) # Establish that the response is the type that we expect. @@ -16954,6 +17031,7 @@ def test_create_user_workloads_config_map_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.UserWorkloadsConfigMap.to_json( environments.UserWorkloadsConfigMap() ) @@ -17002,6 +17080,7 @@ def test_get_user_workloads_config_map_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_user_workloads_config_map(request) @@ -17039,6 +17118,7 @@ def test_get_user_workloads_config_map_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_user_workloads_config_map(request) # Establish that the response is the type that we expect. @@ -17079,6 +17159,7 @@ def test_get_user_workloads_config_map_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.UserWorkloadsConfigMap.to_json( environments.UserWorkloadsConfigMap() ) @@ -17125,6 +17206,7 @@ def test_list_user_workloads_config_maps_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_user_workloads_config_maps(request) @@ -17160,6 +17242,7 @@ def test_list_user_workloads_config_maps_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_user_workloads_config_maps(request) # Establish that the response is the type that we expect. @@ -17200,6 +17283,7 @@ def test_list_user_workloads_config_maps_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.ListUserWorkloadsConfigMapsResponse.to_json( environments.ListUserWorkloadsConfigMapsResponse() ) @@ -17250,6 +17334,7 @@ def test_update_user_workloads_config_map_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_user_workloads_config_map(request) @@ -17366,6 +17451,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_user_workloads_config_map(request) # Establish that the response is the type that we expect. @@ -17406,6 +17492,7 @@ def test_update_user_workloads_config_map_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.UserWorkloadsConfigMap.to_json( environments.UserWorkloadsConfigMap() ) @@ -17454,6 +17541,7 @@ def test_delete_user_workloads_config_map_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_user_workloads_config_map(request) @@ -17486,6 +17574,7 @@ def test_delete_user_workloads_config_map_rest_call_success(request_type): json_return_value = "" response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_user_workloads_config_map(request) # Establish that the response is the type that we expect. @@ -17522,6 +17611,7 @@ def test_delete_user_workloads_config_map_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = environments.DeleteUserWorkloadsConfigMapRequest() metadata = [ @@ -17562,6 +17652,7 @@ def test_save_snapshot_rest_bad_request(request_type=environments.SaveSnapshotRe response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.save_snapshot(request) @@ -17594,6 +17685,7 @@ def test_save_snapshot_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.save_snapshot(request) # Establish that the response is the type that we expect. @@ -17635,6 +17727,7 @@ def test_save_snapshot_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -17679,6 +17772,7 @@ def test_load_snapshot_rest_bad_request(request_type=environments.LoadSnapshotRe response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.load_snapshot(request) @@ -17711,6 +17805,7 @@ def test_load_snapshot_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.load_snapshot(request) # Establish that the response is the type that we expect. @@ -17752,6 +17847,7 @@ def test_load_snapshot_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -17798,6 +17894,7 @@ def test_database_failover_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.database_failover(request) @@ -17830,6 +17927,7 @@ def test_database_failover_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.database_failover(request) # Establish that the response is the type that we expect. @@ -17871,6 +17969,7 @@ def test_database_failover_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = json_format.MessageToJson(operations_pb2.Operation()) req.return_value.content = return_value @@ -17917,6 +18016,7 @@ def test_fetch_database_properties_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.fetch_database_properties(request) @@ -17956,6 +18056,7 @@ def test_fetch_database_properties_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.fetch_database_properties(request) # Establish that the response is the type that we expect. @@ -17998,6 +18099,7 @@ def test_fetch_database_properties_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = environments.FetchDatabasePropertiesResponse.to_json( environments.FetchDatabasePropertiesResponse() ) @@ -18046,6 +18148,7 @@ def test_delete_operation_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_operation(request) @@ -18076,6 +18179,7 @@ def test_delete_operation_rest(request_type): response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_operation(request) @@ -18106,6 +18210,7 @@ def test_get_operation_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_operation(request) @@ -18136,6 +18241,7 @@ def test_get_operation_rest(request_type): response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_operation(request) @@ -18166,6 +18272,7 @@ def test_list_operations_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_operations(request) @@ -18196,6 +18303,7 @@ def test_list_operations_rest(request_type): response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_operations(request) diff --git a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_image_versions.py b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_image_versions.py index 7f9f7640cf24..f0db504f22fe 100644 --- a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_image_versions.py +++ b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_image_versions.py @@ -1671,6 +1671,7 @@ def test_list_image_versions_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_image_versions(**mock_args) @@ -1963,6 +1964,7 @@ def test_list_image_versions_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_image_versions(request) @@ -1998,6 +2000,7 @@ def test_list_image_versions_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_image_versions(request) # Establish that the response is the type that we expect. @@ -2038,6 +2041,7 @@ def test_list_image_versions_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = image_versions.ListImageVersionsResponse.to_json( image_versions.ListImageVersionsResponse() ) @@ -2086,6 +2090,7 @@ def test_delete_operation_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_operation(request) @@ -2116,6 +2121,7 @@ def test_delete_operation_rest(request_type): response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_operation(request) @@ -2146,6 +2152,7 @@ def test_get_operation_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_operation(request) @@ -2176,6 +2183,7 @@ def test_get_operation_rest(request_type): response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_operation(request) @@ -2206,6 +2214,7 @@ def test_list_operations_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_operations(request) @@ -2236,6 +2245,7 @@ def test_list_operations_rest(request_type): response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_operations(request)